On Tue, 7 Apr 2009, Dominique Dhumieres wrote: > + sed = "/#define[ \t]+INTPTR_MIN[\t]+INT64_MIN/#define INTPTR_MIN > ((intptr_t) INT64_MIN)/"; > + sed = "/#define[ \t]+INTPTR_MIN[\t]+INT32_MIN/#define INTPTR_MIN > ((intptr_t) INT32_MIN)/"; > + sed = "/#define[ \t]+INTPTR_MAX[\t]+INT64_MAX/#define INTPTR_MAX > ((intptr_t) INT64_MAX)/"; > + sed = "/#define[ \t]+INTPTR_MAX[\t]+INT32_MAX/#define INTPTR_MAX > ((intptr_t) INT32_MAX)/"; > + sed = "/#define[ \t]+UINTPTR_MIN[\t]+INT64_MIN/#define UINTPTR_MIN > ((uintptr_t) INT64_MIN)/"; > + sed = "/#define[ \t]+UINTPTR_MIN[\t]+INT32_MIN/#define UINTPTR_MIN > ((uintptr_t) INT32_MIN)/"; > + sed = "/#define[ \t]+UINTPTR_MAX[\t]+INT64_MAX/#define UINTPTR_MAX > ((uintptr_t) INT64_MAX)/"; > + sed = "/#define[ \t]+UINTPTR_MAX[\t]+INT32_MAX/#define UINTPTR_MAX > ((uintptr_t) INT32_MAX)/"; > + sed = "/#define[ \t]+SIZE_MAX[\t]+INT32_MAX/#define SIZE_MAX ((size_t) > INT32_MAX)/"; > + sed = "/#define[ \t]+SIZE_MAX[\t]+INT64_MAX/#define SIZE_MAX ((size_t) > INT64_MAX)/"; > + sed = "/#define[ \t]+UINT8_C(v)[\t]+(v ## U)/#define[\t]+UINT8_C(v) > (v)/"; > + sed = "/#define[ \t]+UINT16_C(v)[\t]+(v ## U)/#define[\t]+UINT16_C(v) > (v)/";
This is the fix proper. It's not *correct*, in that the macros must be usable in #if conditions which means they must not contain casts, although the testcases may not cover this issue accurately. > + test_text = "#define INTPTR_MIN INT64_MIN\n" > + "#define INTPTR_MAX INT64_MAX\n" > + "#define UINTPTR_MIN UINT64_MIN\n" > + "#define UINTPTR_MAX UINT64_MAX\n" > + "#define SIZE_MAX UINT64_MAX\n" > + "#define UINT8_C(v) (v ## U)\n" > + "#define UINT16_C(v) (v ## U)\n"; This is one half of the testcase for the fix: text taken from the broken system header. The other half of the testcase for the fix is updates to tests/base/stdint.h to show what the output should be for that input from the broken system header. You don't include that diff. Typically you generate it by running the fixincludes testsuite and copying the output header it generates into your source tree after verifying that fixincludes did indeed make the desired changes to the test text. -- Joseph S. Myers jos...@codesourcery.com