/*
+ * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
+ * which only is provided by AIX xlc C99.
+ */
+fix = {
+ hackname = aix_complex;
+ mach = "*-*-aix*";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]__I";
+ c_fix = format;
+ c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+ test_text = "#define _Complex_I __I\n";
+};
+
+
+/*
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace
* which violates a requirement of ISO C.
*/
/*
+ * AIX stdint.h fixes.
+ */
+fix = {
+ hackname = aix_stdint_1;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
+ "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
+ c_fix = format;
+ c_fix_arg = "#define UINT8_MAX (255)\n"
+ "#define UINT16_MAX (65535)";
+ test_text = "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
+};
+
+
+fix = {
+ hackname = aix_stdint_2;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 9223372036854775807L\n"
+ "#define UINTPTR_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 2147483647L\n"
+ "#define UINTPTR_MAX 4294967295UL";
+ test_text = "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define UINTPTR_MAX UINT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_3;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
+ "#else\n"
+ "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
+ "#define PTRDIFF_MAX 9223372036854775807L\n"
+ "#else\n"
+ "#define PTRDIFF_MIN (-2147483647L - 1)\n"
+ "#define PTRDIFF_MAX 2147483647L";
+ test_text = "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define PTRDIFF_MAX INT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_4;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define SIZE_MAX 4294967295UL";
+ test_text = "#define SIZE_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX UINT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_5;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
+ "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
+ c_fix = format;
+ c_fix_arg = "#define UINT8_C(c) c\n"
+ "#define UINT16_C(c) c";
+ test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
+ "#define UINT16_C(c) __CONCAT__(c,U)";
+};
+
+
+/*
* sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
* in an otherwise harmless (and #ifed out) macro definition
*/
/*
- * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the
- * definition of struct rusage, so the prototype added by fixproto fails.
- */
-fix = {
- hackname = aix_syswait;
- files = sys/wait.h;
- select = "^extern pid_t wait3\\(\\);\n";
- select = "bos325,";
- c_fix = format;
- c_fix_arg = "struct rusage;\n%0";
- test_text = "/* bos325, */\n"
- "extern pid_t wait3();\n"
- "\t/* pid_t wait3(int *, int, struct rusage *); */";
-};
-
-
-/*
* sys/wait.h on AIX 5.2 defines macros that have both signed and
* unsigned types in conditional expressions.
*/
/*
+ * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
+ */
+fix = {
+ hackname = alpha_if_semicolon;
+ files = net/if.h;
+ select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
+ c_fix = format;
+ c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
+ test_text = ' struct sockaddr vmif_paddr /* protocol address */';
+};
+
+
+/*
* Remove erroneous parentheses in sym.h on Alpha OSF/1.
*/
fix = {
/*
+ * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
+ * unsigned constants.
+ */
+fix = {
+ hackname = darwin_stdint_1;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
+ select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
+ "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
+ test_text = "#define UINT8_C(v) (v ## U)\n"
+ "#define UINT16_C(v) (v ## U)";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
+ * with wrong types.
+ */
+fix = {
+ hackname = darwin_stdint_2;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MAX 9223372036854775807L\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#else\n"
+ "#define INTPTR_MAX 2147483647L\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MIN[ \t]+INT64_MIN\n"
+ "#define INTPTR_MAX[ \t]+INT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN[ \t]+INT32_MIN\n"
+ "#define INTPTR_MAX[ \t]+INT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_3;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define UINTPTR_MAX 4294967295UL\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
+ "#else\n"
+ "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_4;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define SIZE_MAX 4294967295UL\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX[ \t]+UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX[ \t]+UINT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX UINT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_5;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
+ "#define INTMAX_MAX 9223372036854775807L\n"
+ "#define UINTMAX_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
+ "#define INTMAX_MAX 9223372036854775807LL\n"
+ "#define UINTMAX_MAX 18446744073709551615ULL\n"
+ "#endif";
+ select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
+ "#define INTMAX_MAX[ \t]+INT64_MAX\n"
+ "\n"
+ "#define UINTMAX_MAX[ \t]+UINT64_MAX";
+ test_text = "#define INTMAX_MIN INT64_MIN\n"
+ "#define INTMAX_MAX INT64_MAX\n"
+ "\n"
+ "#define UINTMAX_MAX UINT64_MAX";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_C
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_6;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
+ "#define PTRDIFF_MAX 9223372036854775807L\n"
+ "#else\n"
+ "#define PTRDIFF_MIN (-2147483647 - 1)\n"
+ "#define PTRDIFF_MAX 2147483647\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
+ "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
+ "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define PTRDIFF_MAX INT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_C
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_7;
+ mach = "*-*-darwin*";
+ files = stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTMAX_C(v) (v ## L)\n"
+ "#define UINTMAX_C(v) (v ## UL)\n"
+ "#else\n"
+ "#define INTMAX_C(v) (v ## LL)\n"
+ "#define UINTMAX_C(v) (v ## ULL)\n"
+ "#endif";
+ select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
+ "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
+ test_text = "#define INTMAX_C(v) (v ## LL)\n"
+ "#define UINTMAX_C(v) (v ## ULL)";
+};
+
+
+/*
* Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function,
* clashing with gcc's asm keyword. So protect this with __DECC.
/*
- * math.h on SunOS 4 puts the declaration of matherr before the definition
- * of struct exception, so the prototype (added by fixproto) causes havoc.
- * This must appear before the math_exception fix.
- */
-fix = {
- hackname = exception_structure;
- files = math.h;
-
- /* If matherr has a prototype already, the header needs no fix. */
- bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
- select = matherr;
-
- c_fix = wrap;
- c_fix_arg = "struct exception;\n";
-
- test_text = "extern int matherr();";
-};
-
-
-/*
* Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
* neither the existence of GCC 3 nor its exact feature set yet break
* (by design?) when __GNUC__ is set beyond 2.
};
+/* glibc versions before 2.5 have a version of stdint.h that defines
+ UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
+ versions with stdint.h based on those glibc versions. */
+fix = {
+ hackname = glibc_stdint;
+ files = stdint.h;
+ select = "GNU C Library";
+ c_fix = format;
+ c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
+ c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
+ test_text = "/* This file is part of the GNU C Library. */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
+};
+
+
+/* glibc's tgmath.h relies on an expression that is not an integer
+ constant expression being treated as it was by GCC 4.4 and
+ earlier. */
+fix = {
+ hackname = glibc_tgmath;
+ files = tgmath.h;
+ select = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)';
+ bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
+ c_fix = format;
+ c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
+ test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
+};
+
/*
* Fix these files to use the types we think they should for
* ptrdiff_t, size_t, and wchar_t.
"extern int snprintf(char *, _hpux_size_t, char *, ...);";
};
-
-/*
- * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
- * of UINT32_C has undefined behavior according to ISO/ANSI:
- * the arguments to __CONCAT__ are not macro expanded before the
- * concatination happens so the trailing ')' in the first argument
- * is concatinated with the 'l' in the second argument creating an
- * invalid pp token. The behavior of invalid pp tokens is undefined.
- * GCC does not handle these invalid tokens the way the HP compiler does.
- * This problem will potentially occur anytime macros are used in the
- * arguments to __CONCAT__. A general solution to this problem would be to
- * insert another layer of macro between __CONCAT__ and its use
- * in UINT32_C. An example of this solution can be found in the C standard.
- * A more specific solution, the one used here, is to change the UINT32_C
- * macro to not used macros in the arguments to __CONCAT__.
- */
-fix = {
- hackname = hpux11_uint32_c;
- files = inttypes.h;
- select = "^#define UINT32_C\\(__c\\)[ \t]*"
- "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
- c_fix = format;
- c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
- test_text =
- "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
- "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
-};
-
-
/*
* Fix hpux 11.00 broken vsnprintf declaration
*/
*/
fix = {
hackname = hpux_long_double;
+ mach = "*-*-hpux10*";
+ mach = "*-*-hpux11.[012]*";
files = stdlib.h;
select = "extern[ \t]long_double[ \t]strtold";
bypass = "long_double_t";
"extern long_double strtold(const char *, char **);\n";
};
+ /*
+ * We cannot use the above rule on 11.31 because it removes the strtold
+ * definition. ia64 is OK with no hack, PA needs some help.
+ */
+fix = {
+ hackname = hpux_long_double_2;
+ mach = "hppa*-*-hpux11.3*";
+ files = stdlib.h;
+ select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
+ c_fix = format;
+ c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
+
+ test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)\n";
+};
/*
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
fix = {
hackname = hpux_spu_info;
mach = "*-hp-hpux*";
+ /*
+ * It is tempting to omit the first "files" entry. Do not.
+ * The testing machinery will take the first "files" entry as the name
+ * of a test file to play with. It would be a nuisance to have a directory
+ * with the name "*".
+ */
+ files = "ia64/sys/getppdp.h";
files = "*/sys/getppdp.h";
select = "^.*extern.*spu_info.*";
"}\n";
};
+fix = {
+ hackname = hpux_c99_intptr;
+ mach = "*-hp-hpux11.3*";
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
+ test_text = "#define PTRDIFF_MAX INT32_MAX\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#define SIZE_MAX UINT32_MAX\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+
+fix = {
+ hackname = hpux_c99_inttypes;
+ mach = "*-hp-hpux11.[23]*";
+ files = inttypes.h;
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@#define UINT32_C(__c) __CONCAT__(__c,u)@";
+ test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n"
+ "#define UINT16_C(__c) __CONCAT_U__(__c)\n"
+ "#define INT32_C(__c) __CONCAT__(__c,l)\n"
+ "#define UINT32_C(__c) __CONCAT__(__c,ul)\n";
+};
+
+fix = {
+ hackname = hpux_c99_inttypes2;
+ mach = "*-hp-hpux11.2*";
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
+ test_text = "# define INT8_C(__c) ((signed char)(__c))\n"
+ "# define UINT8_C(__c) ((unsigned char)(__c))\n"
+ "# define INT16_C(__c) ((short)(__c))\n"
+ "# define UINT16_C(__c) ((unsigned short)(__c))\n";
+};
+
+fix = {
+ hackname = hpux_stdint_least_fast;
+ mach = "*-hp-hpux11.2*";
+ files = stdint.h;
+ select =
+ "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
+ c_fix = format;
+ c-fix-arg = <<- _EOFix_
+ #ifdef __LP64__
+ # define UINT_%164_MAX ULONG_MAX
+ #else
+ %0
+ #endif
+ _EOFix_;
+ test-text = <<- _EOFix_
+ # define UINT_FAST64_MAX ULLONG_MAX
+ # define UINT_LEAST64_MAX ULLONG_MAX
+ _EOFix_;
+};
+
+fix = {
+ hackname = hpux_inttype_int8_t;
+ mach = "*-hp-hpux1[01].*";
+ files = sys/_inttypes.h;
+ select = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*";
+ c_fix = format;
+ c_fix_arg = "typedef signed char int%18_t;";
+ test_text = "typedef char int_least8_t;\n"
+ "typedef char int8_t;\n";
+};
+
+fix = {
+ hackname = hpux_imaginary_i;
+ mach = "ia64-hp-hpux11.*";
+ files = complex.h;
+ select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
+ c_fix = format;
+ c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+ test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
+};
+
/*
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant
*/
/*
+ * IRIX 6.5 complex.h defines _Complex_I and _Imaginary_I in terms of __I__,
+ * which is a MIPSpro compiler builtin. Remove _Imaginary_I and imaginary
+ * definitions which are not supported by GCC.
+ */
+fix = {
+ hackname = irix_complex;
+ mach = "mips-sgi-irix6.5";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
+ sed = "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/"
+ "#define _Complex_I (__extension__ 1.0iF)/";
+ sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
+ sed = "/#define[ \t]_Imaginary_I/d";
+ sed = "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/";
+ test_text = "#define _Complex_I ((float _Complex) (__I__))\n"
+ "#define imaginary _Imaginary\n"
+ "// #define _Imaginary_I ((float _Imaginary) 1)\n"
+ "#define _Imaginary_I __I__\n"
+ "#define I _Imaginary_I";
+};
+
+
+/*
* Non-traditional "const" declaration in Irix's limits.h.
*/
fix = {
* Interface Definition), which conflicts with the class exception defined
* in the C++ file std/stdexcept.h. We redefine it to __math_exception.
* This is not a great fix, but I haven't been able to think of anything
- * better. Note that we have to put the #ifdef/#endif blocks at beginning
- * and end of file, because fixproto runs after us and may insert
- * additional references to struct exception.
+ * better.
*/
fix = {
hackname = math_exception;
};
+/* newlib's stdint.h has several failures to conform to C99. The fix
+ for these removed a comment that can be matched to identify unfixed
+ versions. */
+fix = {
+ hackname = newlib_stdint_1;
+ files = stdint.h;
+ select = "@todo - Add support for wint_t types";
+ sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
+ sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
+ sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
+ sed = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
+ sed = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
+ sed = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
+ sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
+ sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
+ sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
+ sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
+ sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+ sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
+ sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
+ sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
+ test_text = "/* @todo - Add support for wint_t types. */\n"
+ "#define INT32_MIN (-2147483647-1)\n"
+ "#define INT32_MAX 2147483647\n"
+ "#define UINT32_MAX 4294967295U\n"
+ "#define INT_LEAST32_MIN (-2147483647-1)\n"
+ "#define INT_LEAST32_MAX 2147483647\n"
+ "#define UINT_LEAST32_MAX 4294967295U\n"
+ "#define INT_FAST8_MIN INT8_MIN\n"
+ "#define INT_FAST8_MAX INT8_MAX\n"
+ "#define UINT_FAST8_MAX UINT8_MAX\n"
+ "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
+ "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
+ "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
+ "#define UINT8_C(x) x##U\n"
+ "#define UINT16_C(x) x##U";
+};
+
+
+fix = {
+ hackname = newlib_stdint_2;
+ files = stdint.h;
+ select = "@todo - Add support for wint_t types";
+ c_fix = format;
+ c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n"
+ "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
+ "#define UINTMAX_MAX __UINTMAX_MAX__\n"
+ "#define WCHAR_MAX __WCHAR_MAX__\n"
+ "#define WCHAR_MIN __WCHAR_MIN__\n"
+ "#define WINT_MAX __WINT_MAX__\n"
+ "#define WINT_MIN __WINT_MIN__\n\n"
+ "%0";
+ c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/';
+ test_text = "/* @todo - Add support for wint_t types. */\n"
+ "/** Macros for minimum-width integer constant expressions */";
+};
+
+
/*
* NeXT 3.2 adds const prefix to some math functions.
* These conflict with the built-in functions.
/*
- * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
- * The original ones fail if uninitialized externs are not common.
- * This is the default for all ANSI standard C++ compilers.
- */
-fix = {
- hackname = pthread_page_size;
- files = pthread.h;
- select = "^int __page_size";
- c_fix = format;
- c_fix_arg = "extern %0";
- test_text = "int __page_size;";
-};
-
-/*
* On broken glibc-2.3.3 systems an array of incomplete structures is
* passed to __sigsetjmp. Fix that to take a pointer instead.
*/
/*
+ * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
+ * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
+ * and imaginary definitions which are not supported by GCC.
+ */
+fix = {
+ hackname = solaris_complex;
+ mach = "*-*-solaris2.*";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]_Complex_I";
+ sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
+ "#define\t_Complex_I\t\\(__extension__ 1.0iF\\)/";
+ sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
+ sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
+ sed = "s/#define[ \t]I[ \t]\\+_Imaginary_I/#define\tI\t\t_Complex_I/";
+ test_text = "#define _Complex_I _Complex_I\n"
+ "#define complex _Complex\n"
+ "#define _Imaginary_I _Imaginary_I\n"
+ "#define imaginary _Imaginary\n"
+ "#undef I\n"
+ "#define I _Imaginary_I";
+};
+
+
+/*
* Sun Solaris 10 defines several C99 math macros in terms of
* builtins specific to the Studio compiler, in particular not
* compatible with the GNU compiler.
/*
- * Solaris 2.8 has what appears to be some gross workaround for
+ * Sun Solaris 10 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_const;
+ select = '@\(#\)int_const.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_const.h;
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+ "%1\n"
+ "#define\tUINT16_C(c)\t(c)";
+ c_fix_arg = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+ "(/\*.*\*/)\n"
+ "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+ test_text =
+ '#pragma ident "@(#)int_const.h 1.5 04/09/28 SMI"'"\n"
+ "#define UINT8_C(c) __CONCAT__(c,u)\n"
+ "/* CSTYLED */\n"
+ "#define UINT16_C(c) __CONCAT__(c,u)";
+};
+
+
+/*
+ * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_limits_1;
+ select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_limits.h;
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
+ "#define\tUINT16_MAX\t(65535)";
+ c_fix_arg = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
+ "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
+ test_text =
+ '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
+ "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
+};
+
+
+/*
+ * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * INT_FAST16 limits to wrong values for sys/int_types.h.
+ */
+fix = {
+ hackname = solaris_int_limits_2;
+ select = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = sys/int_limits.h;
+ c_fix = format;
+ c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
+ c_fix_arg = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
+ test_text =
+ '#pragma ident "@(#)int_limits.h 1.9 04/09/28 SMI"'"\n"
+ "#define INT_FAST16_MAX INT16_MAX\n"
+ "#define UINT_FAST16_MAX UINT16_MAX\n"
+ "#define INT_FAST16_MIN INT16_MIN";
+};
+
+
+/*
+ * Sun Solaris up to 9 has a version of sys/int_types.h that forbids use
+ * of Standard C99 64-bit types in 32-bit mode.
+ */
+fix = {
+ hackname = solaris_int_types;
+ select = "__STDC__ - 0 == 0";
+ bypass = "_LONGLONG_TYPE";
+ files = sys/int_types.h;
+ c_fix = format;
+ c_fix_arg =
+ "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
+ test_text =
+ "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
+ "typedef long long int64_t;\n"
+ "#endif\n\n"
+ "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
+ "typedef int64_t intmax_t;\n"
+ "#endif";
+};
+
+
+/*
+ * Sun Solaris 8 has what appears to be some gross workaround for
* some old version of their c++ compiler. G++ doesn't want it
* either, but doesn't want to be tied to SunPRO version numbers.
*/