===================================================================
@@ -3,9 +3,9 @@
[= (dne " * " "/* ")=]
*/
/* DO NOT SVN-MERGE THIS FILE, EITHER [=
- (define re-ct 0) (define max-mach 0) (define ct 0)
- (define HACK "") (define Hack "") (define tmp "")
- (shell "date") =]
+ (define re-ct 0) (define max-mach 0) (define ct 0)
+ (define HACK "") (define Hack "") (define tmp "")
+ (define tmp-len 0) (shell "date") =]
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -45,6 +45,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Description of [=
+ (define entry-list "")
+ (define entry-ct 0)
(set! Hack (string-capitalize! (get "hackname")))
(set! HACK (string-upcase! (get "hackname")))
(if (and (not (exist? "test_text")) (not (exist? "replace")))
@@ -56,40 +58,48 @@
some C fix wishes to refer to the regexps it is paired with.
See commentary at the top of fixfixes.c.
=]
-tSCC z[=(. Hack)=]Name[] =
- "[=hackname=]";
-
-/*
- * File name selection pattern
- */[=
+static char const z[=(. Hack)=]Name[] =
+ "[=hackname=]";[=
IF (exist? "files")=]
-tSCC z[=(. Hack)=]List[] =
- "[= (join "\\0" (stack "files")) =]\0";[=
+static char const z[=(. Hack)=]FileList[] =
+ "[= (join "\\0" (stack "files")) =]\0";[=
ELSE =]
-#define z[=(. Hack)=]List (char*)NULL[=
+#define z[=(. Hack)=]FileList (char*)NULL[=
ENDIF (exist? "files") =]
/*
* Machine/OS name selection pattern
*/[=
- IF (exist? "mach")=]
-tSCC* apz[=(. Hack)=]Machs[] = {[=
- (set! ct 0) =][=
-
- FOR mach =]
- [=
- (set! tmp (get "mach"))
- (set! ct (+ ct (string-length tmp) 5))
- (kr-string tmp)=],[=
- ENDFOR=]
- (const char*)NULL };[=
+ IF (exist? "mach") =][=
+ (set! ct 0)
+ (set! entry-ct 1)
+ (set! entry-list "") =][=
+
+ FOR mach =][=
+ (set! tmp (string-append "pz" Hack "Machs_" (number->string entry-ct)))
+ (set! entry-list (string-append entry-list tmp ",\n"))
+ (emit (string-append "\nstatic char const " tmp))
+
+ (set! tmp (get "mach"))
+ (set! tmp-len (string-length tmp))
+ (ag-fprintf 0 "[%d] =\n %s;" (+ 1 tmp-len) (kr-string tmp))
+
+ (set! entry-ct (+ entry-ct 1))
+ (set! ct (+ ct 5)) =][=
+
+ ENDFOR =]
+static char const * const apz[=(. Hack)=]Machs[[=(. entry-ct)=]] = {
+[= (shell (string-append
+ "columns -I4 --spread=1 <<_EOF_\n" entry-list "_EOF_"
+ )) =]
+ (char const *)NULL };[=
(if (> ct max-mach) (set! max-mach ct)) =][=
ELSE =]
-#define apz[=(. Hack)=]Machs (const char**)NULL[=
+#define apz[=(. Hack)=]Machs (char const * const *)NULL[=
ENDIF (exist? "mach") =][=
IF (exist? "select")=]
@@ -98,7 +108,7 @@
* content selection pattern - do fix if pattern found
*/[=
FOR select =]
-tSCC z[=(. Hack)=]Select[=(for-index)=][] =
+static char const z[=(. Hack)=]Select[=(for-index)=][] =
[=(kr-string (get "select"))=];[=
ENDFOR select =][=
ENDIF =][=
@@ -109,7 +119,7 @@
* content bypass pattern - skip fix if pattern found
*/[=
FOR bypass =]
-tSCC z[=(. Hack)=]Bypass[=(for-index)=][] =
+static char const z[=(. Hack)=]Bypass[=(for-index)=][] =
[=(kr-string (get "bypass"))=];[=
ENDFOR bypass =][=
ENDIF =][=
@@ -120,7 +130,7 @@
* perform the 'test' shell command - do fix on success
*/[=
FOR test =]
-tSCC z[=(. Hack)=]Test[=(for-index)=][] =
+static char const z[=(. Hack)=]Test[=(for-index)=][] =
[=(kr-string (get "test"))=];[=
ENDFOR =][=
ENDIF =][=
@@ -131,7 +141,7 @@
* perform the C function call test
*/[=
FOR c_test =]
-tSCC z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
+static char const z[=(. Hack)=]FTst[=(for-index)=][] = "[=c_test=]";[=
ENDFOR c_test =][=
ENDIF =][=
@@ -167,27 +177,59 @@
/*
* Fix Command Arguments for [=(. Hack)=]
- */
-static const char* apz[=(. Hack)=]Patch[] = {[=
- IF (exist? "sed")=] sed_cmd_z[=
- FOR sed=],
- "-e", [=(kr-string (get "sed"))=][=
- ENDFOR sed=],[=
-
- ELIF (exist? "shell")=] "sh", "-c",
- [=(kr-string (get "shell"))=],[=
-
- ELIF (exist? "c_fix")=]
- [=(kr-string (get "c_fix"))=],[=
-
- FOR c_fix_arg =]
- [=(kr-string (get "c_fix_arg"))=],[=
- ENDFOR c_fix_arg =][=
+ */[=
+
+ IF (exist? "shell") =]
+static char const z[=(. Hack)=]ShellScript[[=
+ (set! tmp (get "shell"))
+ (+ 1 (string-length tmp)) =]] =
+ [=(kr-string tmp)=];[=
+
+
+ ELIF (exist? "c-fix") =][=
+ (set! entry-ct 0)
+ (set! entry-list "") =][=
+
+ FOR c-fix-arg =][=
+ (set! tmp (get "c-fix-arg"))
+ (sprintf "\nstatic char const z%sCFixArg_%d[%d] =\n %s;"
+ Hack (for-index) (+ 1 (string-length tmp)) (kr-string tmp) )
+ =][=
+ ENDFOR c-fix-arg =][=
+
+
+ ELIF (> (len "replace") 0) =]
+static char const z[=(. Hack)=]Replacement[[=
+ (set! tmp (get "replace"))
+ (+ 1 (string-length tmp)) =]] =
+ [=(kr-string tmp)=];[=
+
+ ENDIF
+
+
+=]
+static char const * const apz[=(. Hack)=]Patch[] = {[=
+ IF (exist? "sed")=] sed_cmd_z,[=
+ FOR sed =]
+ "-e", [=(kr-string (get "sed"))=],[=
+
+ ENDFOR sed =][=
+
+ ELIF (exist? "shell") =]
+ "sh", "-c", z[=(. Hack)=]ShellScript,[=
+
+ ELIF (exist? "c-fix") =]
+ "[=(get "c-fix")=]",[=
+
+ FOR c-fix-arg =][=
+ (sprintf "\n z%sCFixArg_%d," Hack (for-index))
+ =][=
+ ENDFOR c-fix-arg =][=
- ELIF (> (len "replace") 0) =]
-[=(kr-string (get "replace"))=],[=
+ ELIF (> (len "replace") 0) =]
+ z[=(. Hack)=]Replacement,[=
- ENDIF=]
+ ENDIF =]
(char*)NULL };
[=ENDFOR fix=]
@@ -215,13 +257,14 @@
=]
} t_fixinc_idx;
-tFixDesc fixDescList[ FIX_COUNT ] = {[=
+tFixDesc const fixDescList[ FIX_COUNT ] = {[=
FOR fix ",\n" =][=
(set! Hack (string-capitalize! (get "hackname")))
(set! HACK (string-upcase! (get "hackname"))) =]
- { z[=(. Hack)=]Name, z[=(. Hack)=]List,
+ { z[=(. Hack)=]Name,
+ z[=(. Hack)=]FileList,
apz[=(. Hack)=]Machs,
[=(. HACK)=]_TEST_CT, [=
IF (exist? "not_machine") =]FD_MACH_IFNOT[=
===================================================================
<<<GENERATED>>>
===================================================================
@@ -76,8 +76,8 @@
# define STATIC
#endif
-#define tSCC static const char
-#define tCC const char
+#define tSCC static char const
+#define tCC char const
#define tSC static char
/* If this particular system's header files define the macro `MAXPATHLEN',
@@ -192,14 +192,15 @@
typedef struct fix_desc tFixDesc;
struct fix_desc
{
- tCC* fix_name; /* Name of the fix */
- tCC* file_list; /* List of files it applies to */
- tCC** papz_machs; /* List of machine/os-es it applies to */
- int test_ct;
- int fd_flags;
- tTestDesc* p_test_desc;
- tCC** patch_args;
- long unused;
+ char const * fix_name; /* Name of the fix */
+ char const * file_list; /* List of files it applies to */
+ char const * const *
+ papz_machs; /* List of machine/os-es it applies to */
+ int const test_ct;
+ int fd_flags;
+ tTestDesc * p_test_desc;
+ char const ** patch_args;
+ long unused;
};
typedef struct {
===================================================================
@@ -62,7 +62,7 @@
AG="autogen $AG"
set -e
-if [ -z "`${AG} -v | fgrep 'Ver. 5.'`" ]
+if [ -z "`${AG} -? | fgrep 'Ver. 5.'`" ]
then
echo "AutoGen appears to be out of date or not correctly installed."
echo "Please download and install:"
===================================================================
@@ -64,7 +64,6 @@
_EOArg_;
};
-
/*
* On Mac OS 10.3.9, the 'long double' functions are available in
* libSystem, but are not prototyped in math.h.
@@ -157,7 +156,6 @@
_EndOfHeader_;
};
-
/*
* ... and for the previous fix to be useful, you have to not use ""
* includes.
@@ -169,13 +167,12 @@
select = '#include[ \t]+\"';
c_fix = format;
c_fix_arg = "%1<%2.h>";
-
+
c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
-
+
test_text = '#include "architecture/ppc/math.h"';
};
-
/*
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
*/
@@ -217,7 +214,6 @@
_EndOfHeader_;
};
-
/*
* This fixes __FD_ZERO bug for glibc-1.x
*/
@@ -255,7 +251,6 @@
_EndOfHeader_;
};
-
/*
* This fixes __FD_ZERO bug for glibc-2.0.x
*/
@@ -297,7 +292,6 @@
_EndOfHeader_;
};
-
/*
* Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing
* the same interface as <stdarg.h>. No idea why they couldn't have just
@@ -316,7 +310,6 @@
_EndOfHeader_;
};
-
/*
* Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
* declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
@@ -354,7 +347,6 @@
_EndOfHeader_;
};
-
/*
* 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.
@@ -369,7 +361,6 @@
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.
@@ -384,7 +375,6 @@
"{...init stuff...}";
};
-
/*
* AIX stdint.h fixes.
*/
@@ -484,7 +474,6 @@
"#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
@@ -499,7 +488,6 @@
" bar \\ \n baz \\ \n bat";
};
-
/*
* sys/wait.h on AIX 5.2 defines macros that have both signed and
* unsigned types in conditional expressions.
@@ -510,10 +498,10 @@
select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
c_fix = format;
c_fix_arg = "? (int)%1";
- test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
+ test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? "
+ "((((unsigned int)__x) >> 8) & 0xff) : -1)";
};
-
/*
* sys/signal.h on some versions of AIX uses volatile in the typedef of
* sig_atomic_t, which causes gcc to generate a warning about duplicate
@@ -529,7 +517,6 @@
test_text = "typedef volatile int sig_atomic_t;";
};
-
/*
* Fix __assert declaration in assert.h on Alpha OSF/1.
*/
@@ -542,7 +529,6 @@
test_text = 'extern void __assert(char *, char *, int);';
};
-
/*
* Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
*/
@@ -563,7 +549,6 @@
"# pragma extern_prefix \"\"";
};
-
/*
* Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 <standards.h>.
*/
@@ -580,7 +565,6 @@
"&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
};
-
/*
* Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/mount.h> and
* <sys/stat.h>. The tests for __DECC are special in various ways, so
@@ -599,7 +583,6 @@
test_text = "# if defined(__DECC)";
};
-
/*
* Fix assert macro in assert.h on Alpha OSF/1.
* The superfluous int cast breaks C++.
@@ -614,7 +597,6 @@
': __assert(#EX, __FILE__, __LINE__))';
};
-
/*
* Fix #defines under Alpha OSF/1:
* The following files contain '#pragma extern_prefix "_FOO"' followed by
@@ -645,7 +627,6 @@
"#define mumble _FOOmumble";
};
-
/*
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/
@@ -659,7 +640,6 @@
test_text = 'extern int getopt(int, char *[], char *);';
};
-
/*
* Fix missing semicolon on Alpha OSF/4 in <net/if.h>
*/
@@ -672,7 +652,6 @@
test_text = ' struct sockaddr vmif_paddr /* protocol address */';
};
-
/*
* Remove erroneous parentheses in sym.h on Alpha OSF/1.
*/
@@ -685,7 +664,6 @@
test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
};
-
/*
* Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
*/
@@ -710,7 +688,6 @@
"# endif";
};
-
/*
* Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
*/
@@ -731,7 +708,6 @@
"#endif";
};
-
/*
* Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
* incorrectly, specifying less fields in the initializers than are
@@ -778,7 +754,6 @@
_EOText_;
};
-
/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
* And OpenBSD.
@@ -792,7 +767,6 @@
test_text = "extern char* sbrk(ptrdiff_t increment);";
};
-
/*
* For C++, avoid any typedef or macro definition of bool,
* and use the built in type instead.
@@ -832,7 +806,6 @@
test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
};
-
/*
* For C++, avoid any typedef definition of wchar_t,
* and use the built in type instead.
@@ -856,7 +829,6 @@
test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
};
-
/*
* Fix `typedef struct term;' on hppa1.1-hp-hpux9.
*/
@@ -870,7 +842,6 @@
test_text = 'typedef struct term;';
};
-
/*
* Fix one other error in this file:
* a mismatched quote not inside a C comment.
@@ -885,7 +856,6 @@
test_text = "/* doesn't have matched single quotes */";
};
-
/*
* check for broken assert.h that needs stdio.h
*/
@@ -899,7 +869,6 @@
test_text = "extern FILE* stderr;";
};
-
/*
* check for broken assert.h that needs stdlib.h
*/
@@ -915,7 +884,6 @@
test_text = "extern void exit ( int );";
};
-
/*
* Remove `extern double cabs' declarations from math.h.
* This conflicts with C99. Discovered on AIX.
@@ -945,10 +913,9 @@
"extern long double cabsl( struct __cabsl_s );";
};
-
/*
* Fixup Darwin's broken check for __builtin_nanf.
- */
+ */
fix = {
hackname = broken_nan;
/*
@@ -961,12 +928,11 @@
files = "architecture/*/math.h";
select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
bypass = "powl";
- c_fix = format;
+ c_fix = format;
c_fix_arg = "#if 1";
test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
};
-
/*
* Various systems derived from BSD4.4 contain a macro definition
* for vfscanf that interacts badly with requirements of builtin-attrs.def.
@@ -986,7 +952,6 @@
test_text = '#define vfscanf __svfscanf';
};
-
/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
@@ -1026,7 +991,6 @@
test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)";
};
-
/*
* sys/mman.h on HP/UX is not C++ ready,
* even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
@@ -1054,7 +1018,6 @@
test_text = "extern void* malloc( size_t );";
};
-
/*
* On darwin8 and earlier, mach-o/swap.h isn't properly guarded
* by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded.
@@ -1080,7 +1043,6 @@
test_text = "extern void swap_fat_header();\n";
};
-
/*
* AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
* bad __GNUC__ tests.
@@ -1097,7 +1059,6 @@
"(__GNUC_MINOR__ >= 1)\n";
};
-
/*
* __private_extern__ doesn't exist in FSF GCC. Even if it did,
* why would you ever put it in a system header file?
@@ -1115,7 +1076,6 @@
"unsigned long *address);\n";
};
-
/*
* Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
* unsigned constants.
@@ -1132,7 +1092,6 @@
"#define UINT16_C(v) (v ## U)";
};
-
/*
* Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
* with wrong types.
@@ -1165,7 +1124,6 @@
"#endif";
};
-
/*
* Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
*/
@@ -1191,7 +1149,6 @@
"#endif";
};
-
/*
* Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
*/
@@ -1217,7 +1174,6 @@
"#endif";
};
-
/*
* Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
* with a wrong type.
@@ -1246,7 +1202,6 @@
"#define UINTMAX_MAX UINT64_MAX";
};
-
/*
* Darwin headers have a stdint.h that defines {U,}INTMAX_C
* with a wrong type.
@@ -1279,7 +1234,6 @@
"#endif";
};
-
/*
* Darwin headers have a stdint.h that defines {U,}INTMAX_C
* with a wrong type.
@@ -1302,7 +1256,6 @@
"#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,
@@ -1320,7 +1273,6 @@
"};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
};
-
/*
* Fix typo in <wchar.h> on DJGPP 2.03.
*/
@@ -1336,7 +1288,6 @@
"extern __DJ_wint_t x;\n";
};
-
/*
* Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
*/
@@ -1351,7 +1302,6 @@
test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
};
-
/*
* 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
@@ -1368,7 +1318,6 @@
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
};
-
/*
* Some releases of FreeBSD 4 and FreeBSD 5.0 and 5.1 system headers presume
* neither the existence of GCC 4 nor its exact feature set yet break
@@ -1376,7 +1325,7 @@
*/
fix = {
hackname = freebsd_gcc4_breakage;
- mach = "*-*-freebsd*";
+ mach = "*-*-freebsd*";
files = sys/cdefs.h;
select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
c_fix = format;
@@ -1384,7 +1333,6 @@
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
};
-
/*
* Some versions of glibc don't expect the C99 inline semantics.
*/
@@ -1402,7 +1350,6 @@
EOT;
};
-
/*
* Similar, but a version that didn't have __NO_INLINE__
*/
@@ -1412,7 +1359,8 @@
select = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
"(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
c_fix = format;
- c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
+ c_fix_arg = "%1 && (defined __extern_inline || "
+ "defined __GNUC_GNU_INLINE__)\n%2";
test_text = <<-EOT
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
# define __USE_EXTERN_INLINES 1
@@ -1420,7 +1368,6 @@
EOT;
};
-
/*
* The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
* there are many glibc headers which do not respect __USE_EXTERN_INLINES.
@@ -1488,7 +1435,6 @@
EOT;
};
-
/* glibc-2.3.5 defines pthread mutex initializers incorrectly,
* so we replace them with versions that correspond to the
* definition.
@@ -1562,8 +1508,8 @@
_EOText_;
};
-
-/* glibc versions before 2.5 have a version of stdint.h that defines
+/*
+ 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 = {
@@ -1573,11 +1519,12 @@
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";
+ 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";
};
-
-/* Some versions of glibc have a version of bits/string2.h that
+/*
+ Some versions of glibc have a version of bits/string2.h that
produces "value computed is not used" warnings from strncpy; fix
this definition by using __builtin_strncpy instead as in newer
versions. */
@@ -1589,14 +1536,13 @@
c_fix_arg = "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
c_fix_arg = "# define strncpy([^\n]*\\\\\n)*[^\n]*";
test_text = <<-EOT
- # define strncpy(dest, src, n) \
- (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \\
- ? (strlen (src) + 1 >= ((size_t) (n)) \\
- ? (char *) memcpy (dest, src, n) \\
- : strncpy (dest, src, n)) \\
- : strncpy (dest, src, n)))
+# define strncpy(dest, src, n) \
+ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \\
+ ? (strlen (src) + 1 >= ((size_t) (n)) \\
+ ? (char *) memcpy (dest, src, n) \\
+ : strncpy (dest, src, n)) \\
+ : strncpy (dest, src, n)))
EOT;
-
};
/* glibc's tgmath.h relies on an expression that is not an integer
@@ -1608,8 +1554,11 @@
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))";
+ 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))";
};
/*
@@ -1640,7 +1589,6 @@
"typedef ushort_t wchar_t; /* ushort_t */";
};
-
/*
* Fix HP & Sony's use of "../machine/xxx.h"
* to refer to: <machine/xxx.h>
@@ -1660,7 +1608,6 @@
test_text = ' # include "../machine/mumble.h"';
};
-
/*
* Check for (...) in C++ code in HP/UX sys/file.h.
*/
@@ -1676,7 +1623,6 @@
test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
};
-
/*
* Un-Hide a series of five FP defines from post-1999 compliance GCC:
* FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
@@ -1710,7 +1656,6 @@
"# define FP_NAN 4\n";
};
-
/*
* Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
* math.h to prevent clash with define in c_std/bits/std_cmath.h.
@@ -1728,7 +1673,7 @@
#else
# +endif
END_POW_INLINE;
-
+
c_fix = format;
c_fix_arg = "";
@@ -1758,7 +1703,6 @@
" }\n";
};
-
/*
* Fix hpux 10.X missing ctype declarations 1
*/
@@ -1780,7 +1724,6 @@
test_text = "# define _toupper(__c) __toupper(__c)\n";
};
-
/*
* Fix hpux 10.X missing ctype declarations 2
*/
@@ -1821,7 +1764,6 @@
" extern unsigned int *__SB_masks;\n";
};
-
/*
* Fix hpux 10.X missing stdio declarations
*/
@@ -1843,7 +1785,6 @@
test_text = "# define _iob __iob\n";
};
-
/*
* Make sure hpux defines abs in header.
*/
@@ -1857,7 +1798,6 @@
test_text = "#ifndef _MATH_INCLUDED";
};
-
/*
* Keep HP-UX 11 from stomping on C++ math namespace
* with defines for fabsf.
@@ -1877,7 +1817,6 @@
"#endif";
};
-
/*
* Fix C99 constant in __POINTER_SET define.
*/
@@ -1892,7 +1831,6 @@
test_text = "#define __POINTER_SET\t\t((void *) 1LL)";
};
-
/*
* Prevent HP-UX 11 from defining __size_t and preventing size_t from
* being defined by having it define _hpux_size_t instead.
@@ -1910,7 +1848,6 @@
" extern int getpwuid_r( char *, __size_t, struct passwd **);\n";
};
-
/*
* Fix hpux 11.00 broken snprintf declaration
* (third argument is char *, needs to be const char * to prevent
@@ -1944,7 +1881,6 @@
' __va__list);';
};
-
/*
* get rid of bogus inline definitions in HP-UX 8.0
*/
@@ -1962,6 +1898,48 @@
"inline double sqr(double v) { return v**0.5; }";
};
+/*
+ * fix INTn_C(__c) defines for HP/UX 11.[23]* that use __CONCAT_...
+ */
+fix = {
+ hackname = hpux_c99_inttypes;
+ mach = "*-hp-hpux11.[23]*";
+ files = inttypes.h;
+ files = stdint-hpux11.h, 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 INTn_C(__c) defines for HP/UX 11.2* that are cast characers
+ */
+fix = {
+ hackname = hpux_c99_inttypes2;
+ mach = "*-hp-hpux11.2*";
+ files = stdint-hpux11.h, 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 hpux broken ctype macros
@@ -1978,7 +1956,6 @@
"# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
};
-
/*
* Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
*/
@@ -2006,6 +1983,32 @@
"#endif /* ! _XOPEN_SOURCE_EXTENDED */";
};
+/*
+ * fix _Complex_I
+ */
+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 least/normal 8 bit max size
+ */
+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";
+};
/*
* HP-UX long_double
@@ -2037,83 +2040,15 @@
hackname = hpux_long_double_2;
mach = "hppa*-*-hpux11.3*";
files = stdlib.h;
- select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
+ 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_systime;
- files = sys/time.h;
- select = "^extern struct sigevent;";
-
- c_fix = format;
- c_fix_arg = "struct sigevent;";
-
- test_text = 'extern struct sigevent;';
-};
-
-
-/*
- * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
- * type and mpinfou is only defined when _KERNEL is set.
- */
-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.*";
-
- c_fix = format;
- c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
-
- test_text = "extern union mpinfou spu_info[];";
-};
-
-fix = {
- hackname = hpux11_extern_sendfile;
- mach = "*-hp-hpux11.[12]*";
- files = sys/socket.h;
- select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
- c_fix = format;
- c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
- test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
-};
-
-fix = {
- hackname = hpux11_extern_sendpath;
- mach = "*-hp-hpux11.[12]*";
- files = sys/socket.h;
- select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
- c_fix = format;
- c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
- test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
-};
-
-fix = {
- hackname = hpux_extern_errno;
- mach = "*-hp-hpux10.*";
- mach = "*-hp-hpux11.[0-2]*";
- files = errno.h;
- select = "^[ \t]*extern int errno;$";
- c_fix = format;
- c_fix_arg = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
- test_text = " extern int errno;\n";
+ test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || "
+ "defined(_LONG_DOUBLE_STRUCT)\n";
};
-
/*
* Add missing braces to pthread initializer defines.
*/
@@ -2160,12 +2095,18 @@
hackname = hpux_c99_intptr;
mach = "*-hp-hpux11.3*";
files = stdint-hpux11.h, 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)@";
+ 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"
@@ -2175,38 +2116,65 @@
};
/*
- * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
+ * type and mpinfou is only defined when _KERNEL is set.
*/
+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.*";
+
+ c_fix = format;
+ c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
+
+ test_text = "extern union mpinfou spu_info[];";
+};
fix = {
- hackname = hpux_c99_inttypes;
- mach = "*-hp-hpux11.[23]*";
- files = inttypes.h;
- files = stdint-hpux11.h, 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";
+ hackname = hpux11_extern_sendfile;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n"
+ " const struct iovec *, int));\n";
};
fix = {
- hackname = hpux_c99_inttypes2;
- mach = "*-hp-hpux11.2*";
- files = stdint-hpux11.h, 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";
+ hackname = hpux11_extern_sendpath;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n"
+ " const struct iovec *, int));\n";
+};
+
+fix = {
+ hackname = hpux_extern_errno;
+ mach = "*-hp-hpux10.*";
+ mach = "*-hp-hpux11.[0-2]*";
+ files = errno.h;
+ select = "^[ \t]*extern int errno;$";
+ c_fix = format;
+ c_fix_arg = "#ifdef __cplusplus\nextern \"C\" {\n"
+ "#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
+ test_text = " extern int errno;\n";
};
+/*
+ * fix least/fastest 64 bit max sizes
+ */
fix = {
hackname = hpux_stdint_least_fast;
mach = "*-hp-hpux11.2*";
@@ -2220,25 +2188,18 @@
_EOFix_;
};
+/*
+ * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
+ */
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.*";
+ hackname = hpux_systime;
+ files = sys/time.h;
+ select = "^extern struct sigevent;";
+
c_fix = format;
- c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
- test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
+ c_fix_arg = "struct sigevent;";
+
+ test_text = 'extern struct sigevent;';
};
/*
@@ -2256,7 +2217,6 @@
test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
};
-
/*
* Fix glibc definition of HUGE_VALF in terms of hex floating point constant
*/
@@ -2272,7 +2232,6 @@
test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)";
};
-
/*
* Fix glibc definition of HUGE_VALL in terms of hex floating point constant
*/
@@ -2288,7 +2247,6 @@
test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
};
-
/*
* Fix return type of abort and free
*/
@@ -2306,7 +2264,6 @@
"extern int exit(void*);";
};
-
/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
@@ -2348,7 +2305,6 @@
"BSD43__IOWR(T, 1) /* Some are multi-line */";
};
-
/*
* Check for missing ';' in struct
*/
@@ -2365,28 +2321,9 @@
"}; /* mumbled struct */\n";
};
-
-/*
- * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
- * __restrict as restrict iff __c99. This is wrong for C++, which
- * needs many C99 features, but only supports __restrict.
- */
-fix = {
- hackname = irix___restrict;
- files = internal/sgimacros.h;
- select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
-
- mach = "mips-sgi-irix6.5";
- c_fix = format;
- c_fix_arg = "%1"
- "# ifndef __cplusplus\n%2\n# endif";
-
- test_text = "#ifdef __c99\n# define __restrict restrict";
-};
-
/*
* IRIX 6.5.22 <internal/math_core.h> uses the SGI c99 __generic() intrinsic
- * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
+ * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
* functions.
*
* This was probably introduced around IRIX 6.5.18
@@ -2405,14 +2342,14 @@
" : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
" : _%1l(x))\n";
- test_text =
+ test_text =
"#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n";
};
-
-/* Likewise <internal/math_core.h> on IRIX 6.5.19 and later uses the SGI
- compiler's __generic intrinsic to define isgreater, isgreaterequal,
- isless, islessequal, islessgreater and isunordered functions. */
+/*
+ Likewise <internal/math_core.h> on IRIX 6.5.19 and later uses the SGI
+ compiler's __generic intrinsic to define isgreater, isgreaterequal,
+ isless, islessequal, islessgreater and isunordered functions. */
fix = {
hackname = irix___generic2;
files = internal/math_core.h;
@@ -2425,10 +2362,28 @@
" : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n"
" : _%1l(x,y))\n";
- test_text =
- "#define isless(x,y) __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
+ test_text =
+ "#define isless(x,y) "
+ "__generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
};
+/*
+ * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
+ * __restrict as restrict iff __c99. This is wrong for C++, which
+ * needs many C99 features, but only supports __restrict.
+ */
+fix = {
+ hackname = irix___restrict;
+ files = internal/sgimacros.h;
+ select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "%1"
+ "# ifndef __cplusplus\n%2\n# endif";
+
+ test_text = "#ifdef __c99\n# define __restrict restrict";
+};
/*
* IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
@@ -2446,17 +2401,17 @@
test_text = "\t# and we're on vacation";
};
-
/*
* 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.
+ * 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__\\)\\)";
+ 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";
@@ -2469,7 +2424,6 @@
"#define I _Imaginary_I";
};
-
/*
* Non-traditional "const" declaration in Irix's limits.h.
*/
@@ -2482,7 +2436,6 @@
test_text = "extern const char limit; /* test limits */";
};
-
/*
* IRIX 6.5 PTHREAD_*_INITIALIZER need an additional level of braces in
* <pthread.h>.
@@ -2500,7 +2453,6 @@
"#define PTHREAD_RWLOCK_INITIALIZER { 0 }";
};
-
/*
* IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
* Various socket function prototypes use different types instead,
@@ -2526,23 +2478,64 @@
};
/*
+ * IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ * in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+ hackname = irix_stdint_c99_macros;
+ files = stdint-irix65.h, stdint.h;
+ mach = "mips-sgi-irix6.5";
+ sed = "s@^#define INT8_C(x).*int.*_t.*$@"
+ "#define INT8_C(x) (x)@";
+ sed = "s@^#define INT16_C(x).*int.*_t.*$@"
+ "#define INT16_C(x) (x)@";
+ sed = "s@^#define INT32_C(x).*int.*_t.*$@"
+ "#define INT32_C(x) (x)@";
+ sed = "s@^#define INT64_C(x).*int.*_t.*$@"
+ "#define INT64_C(x) (x ## LL)@";
+ sed = "s@^#define UINT8_C(x).*int.*_t.*$@"
+ "#define UINT8_C(x) (x)@";
+ sed = "s@^#define UINT16_C(x).*int.*_t.*$@"
+ "#define UINT16_C(x) (x)@";
+ sed = "s@^#define UINT32_C(x).*int.*_t.*$@"
+ "#define UINT32_C(x) (x ## U)@";
+ sed = "s@^#define UINT64_C(x).*int.*_t.*$@"
+ "#define UINT64_C(x) (x ## ULL)@";
+ sed = "s@^#define INTMAX_C(x).*int.*_t.*$@"
+ "#define INTMAX_C(x) (x ## LL)@";
+ sed = "s@^#define UINTMAX_C(x).*int.*_t.*$@"
+ "#define UINTMAX_C(x) (x ## ULL)@";
+ test_text = "#define INT8_C(x) (int_least8_t)(x)\n"
+ "#define INT16_C(x) (int_least16_t)(x)\n"
+ "#define INT32_C(x) (int_least32_t)(x)\n"
+ "#define INT64_C(x) (int_least64_t)(x)\n"
+ "#define UINT8_C(x) (uint_least8_t)(x)\n"
+ "#define UINT16_C(x) (uint_least16_t)(x)\n"
+ "#define UINT32_C(x) (uint_least32_t)(x)\n"
+ "#define UINT64_C(x) (uint_least64_t)(x)\n"
+ "#define INTMAX_C(x) (intmax_t)(x)\n"
+ "#define UINTMAX_C(x) (uintmax_t)(x)";
+};
+
+/*
* IRIX 6.5 <stdint.h> only works with ISO C99 and errors out
* otherwise.
*/
fix = {
hackname = irix_stdint_c99_mode;
files = stdint.h;
- select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
+ select = "(#ifndef __c99\n)(#error This header file is to be used "
+ "only for c99 mode compilations)";
mach = "mips-sgi-irix6.5";
c_fix = format;
c_fix_arg = "#if 0\n"
"%2";
test_text =
- "#ifndef __c99\n#error This header file is to be used only for c99 mode compilations\n#else";
+ "#ifndef __c99\n#error This header file is to be used "
+ "only for c99 mode compilations\n#else";
};
-
/*
* IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
* match the corresponding types, as required by ISO C99.
@@ -2592,38 +2585,6 @@
"#define SIZE_MAX UINT64_MAX";
};
-
-/*
- * IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
- * in preprocessor tests, although ISO C99 requires this.
- */
-fix = {
- hackname = irix_stdint_c99_macros;
- files = stdint-irix65.h, stdint.h;
- mach = "mips-sgi-irix6.5";
- sed = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x) (x)@";
- sed = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x) (x)@";
- sed = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x) (x)@";
- sed = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x) (x ## LL)@";
- sed = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x) (x)@";
- sed = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x) (x)@";
- sed = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x) (x ## U)@";
- sed = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x) (x ## ULL)@";
- sed = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x) (x ## LL)@";
- sed = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x) (x ## ULL)@";
- test_text = "#define INT8_C(x) (int_least8_t)(x)\n"
- "#define INT16_C(x) (int_least16_t)(x)\n"
- "#define INT32_C(x) (int_least32_t)(x)\n"
- "#define INT64_C(x) (int_least64_t)(x)\n"
- "#define UINT8_C(x) (uint_least8_t)(x)\n"
- "#define UINT16_C(x) (uint_least16_t)(x)\n"
- "#define UINT32_C(x) (uint_least32_t)(x)\n"
- "#define UINT64_C(x) (uint_least64_t)(x)\n"
- "#define INTMAX_C(x) (intmax_t)(x)\n"
- "#define UINTMAX_C(x) (uintmax_t)(x)";
-};
-
-
/*
* IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
* some functions that take a va_list as
@@ -2641,7 +2602,6 @@
"extern int printf( const char *, /* va_list */ char * );";
};
-
/*
* IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
* wcsftime by default. ISO C99 requires the XPG5 variant instead.
@@ -2661,7 +2621,6 @@
"const struct tm *);";
};
-
/*
* These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
* use / * * / to concatenate tokens.
@@ -2686,8 +2645,8 @@
test_text = "#define __CONCAT__(a,b) a/**/b";
};
-
-/* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
+/*
+ * The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
* an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
* constant on recent versions of g++.
*/
@@ -2703,23 +2662,7 @@
"\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
};
-
-/*
- * Remove header file warning from sys/time.h. Autoconf's
- * AC_HEADER_TIME recommends to include both sys/time.h and time.h
- * which causes warning on LynxOS. Remove the warning.
- */
-fix = {
- hackname = lynxos_no_warning_in_sys_time_h;
- files = sys/time.h;
- select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
- c_fix = format;
- c_fix_arg = "";
- test_text = "#warning Using <time.h> instead of <sys/time.h>";
-};
-
-
-/*
+/*
* Add missing declaration for putenv.
*/
fix = {
@@ -2735,6 +2678,19 @@
test_text = "extern char *getenv _AP((const char *));";
};
+/*
+ * Remove header file warning from sys/time.h. Autoconf's
+ * AC_HEADER_TIME recommends to include both sys/time.h and time.h
+ * which causes warning on LynxOS. Remove the warning.
+ */
+fix = {
+ hackname = lynxos_no_warning_in_sys_time_h;
+ files = sys/time.h;
+ select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
+ c_fix = format;
+ c_fix_arg = "";
+ test_text = "#warning Using <time.h> instead of <sys/time.h>";
+};
/*
* Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
@@ -2754,7 +2710,6 @@
test_text = " # define _BSD_VA_LIST_\tchar**";
};
-
/*
* Fix non-ansi machine name defines
*/
@@ -2768,7 +2723,6 @@
"\n/* no uniform test, so be careful :-) */";
};
-
/*
* Some math.h files define struct exception (it's in the System V
* Interface Definition), which conflicts with the class exception defined
@@ -2801,7 +2755,6 @@
test_text = "typedef struct exception t_math_exception;";
};
-
/*
* This looks pretty broken to me. ``dbl_max_def'' will contain
* "define DBL_MAX " at the start, when what we really want is just
@@ -2839,7 +2792,6 @@
"#define HUGE_VAL DBL_MAX";
};
-
/*
* nested comment
*/
@@ -2852,7 +2804,6 @@
test_text = "/*#include <rpc/auth_des.h> /* skip this */";
};
-
/*
* Some versions of NetBSD don't expect the C99 inline semantics.
*/
@@ -2872,7 +2823,9 @@
test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
};
-
+/*
+ * NetBSD fix for _SIGINLINE
+ */
fix = {
hackname = netbsd_c99_inline_2;
mach = "*-*-netbsd*";
@@ -2891,7 +2844,6 @@
test_text = "#define _SIGINLINE extern __inline";
};
-
/*
* NetBSD has a semicolon after the ending '}' for some extern "C".
*/
@@ -2907,23 +2859,32 @@
test_text = "#define __END_DECLS };";
};
-
-/* 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. */
+/*
+ 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-newlib.h, 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 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__@";
@@ -2946,7 +2907,9 @@
"#define UINT16_C(x) x##U";
};
-
+/*
+ * newlib stdint part 2
+ */
fix = {
hackname = newlib_stdint_2;
files = stdint-newlib.h, stdint.h;
@@ -2965,7 +2928,6 @@
"/** Macros for minimum-width integer constant expressions */";
};
-
/*
* NeXT 3.2 adds const prefix to some math functions.
* These conflict with the built-in functions.
@@ -2982,7 +2944,6 @@
test_text = "extern\tdouble\t__const__\tmumble();";
};
-
/*
* NeXT 3.2 uses the word "template" as a parameter for some
* functions. GCC reports an invalid use of a reserved key word
@@ -2999,7 +2960,6 @@
test_text = "extern mumble( char * template); /* fix */";
};
-
/*
* NeXT 3.2 includes the keyword volatile in the abort() and exit()
* function prototypes. That conflicts with the built-in functions.
@@ -3016,7 +2976,6 @@
test_text = "extern\tvolatile\tvoid\tabort();";
};
-
/*
* NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
* Note that version 3 of the NeXT system has wait.h in a different directory,
@@ -3033,7 +2992,6 @@
test_text = "extern pid_d wait(union wait*);";
};
-
/*
* a missing semi-colon at the end of the nodeent structure definition.
*/
@@ -3046,7 +3004,31 @@
test_text = "char *na_addr\t";
};
-/*
+/*
+ * obstack.h used casts as lvalues.
+ *
+ * We need to change postincrements of casted pointers (which are
+ * then dereferenced and assigned into) of the form
+ *
+ * *((TYPE*)PTRVAR)++ = (VALUE)
+ *
+ * into expressions like
+ *
+ * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
+ *
+ * which is correct for the cases used in obstack.h since PTRVAR is
+ * of type char * and the value of the expression is not used.
+ */
+fix = {
+ hackname = obstack_lvalue_cast;
+ files = obstack.h;
+ select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
+ c_fix = format;
+ c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
+ test_text = "*((void **) (h)->next_free)++ = (aptr)";
+};
+
+/*
* Fix OpenBSD's NULL definition.
*/
fix = {
@@ -3075,7 +3057,7 @@
"^#define[ \t]*NULL[ \t]*0L\n"
"^#endif\n"
"^#endif";
- test_text =
+ test_text =
"#ifndef NULL\n"
"#ifdef __GNUG__\n"
"#define NULL __null\n"
@@ -3086,30 +3068,6 @@
};
/*
- * obstack.h used casts as lvalues.
- *
- * We need to change postincrements of casted pointers (which are
- * then dereferenced and assigned into) of the form
- *
- * *((TYPE*)PTRVAR)++ = (VALUE)
- *
- * into expressions like
- *
- * ((*((TYPE*)PTRVAR) = (VALUE)), (PTRVAR += sizeof (TYPE)))
- *
- * which is correct for the cases used in obstack.h since PTRVAR is
- * of type char * and the value of the expression is not used.
- */
-fix = {
- hackname = obstack_lvalue_cast;
- files = obstack.h;
- select = '\*\(\(([^()]*)\*\)(.*)\)\+\+ = \(([^()]*)\)';
- c_fix = format;
- c_fix_arg = "((*((%1*)%2) = (%3)), (%2 += sizeof (%1)))";
- test_text = "*((void **) (h)->next_free)++ = (aptr)";
-};
-
-/*
* Fix OpenBSD's va_start define.
*/
fix = {
@@ -3166,7 +3124,6 @@
test_text = "#include <reg_types.h>";
};
-
/*
* On broken glibc-2.3.3 systems an array of incomplete structures is
* passed to __sigsetjmp. Fix that to take a pointer instead.
@@ -3177,8 +3134,10 @@
select = "struct __jmp_buf_tag";
c_fix = format;
c_fix_arg = "%1 *%2%3";
- c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
- test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
+ c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) "
+ "(__env)\\[1\\](.*)$";
+ test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], "
+ "int __savemask);";
};
/*
@@ -3195,7 +3154,6 @@
test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
};
-
/*
* Fix casts as lvalues in glibc's <rpc/xdr.h>.
*/
@@ -3215,12 +3173,13 @@
files = rpc/xdr.h;
select = "#define[ \t]*IXDR_PUT_LONG.*\\\\\n.*__extension__.*";
c_fix = format;
- c_fix_arg = "#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))";
+ c_fix_arg = "#define IXDR_PUT_LONG(buf, v) "
+ "((long)IXDR_PUT_INT32(buf, (long)(v)))";
test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
- "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
+ "\t(*__extension__((u_int32_t*)(buf))++ = "
+ "(long)htonl((u_long)(v)))";
};
-
/*
* function class(double x) conflicts with C++ keyword on rs/6000
*/
@@ -3236,7 +3195,6 @@
test_text = "extern int class();";
};
-
/*
* Wrong fchmod prototype on RS/6000.
*/
@@ -3249,7 +3207,6 @@
test_text = "extern int fchmod(char *, mode_t);";
};
-
/*
* parameters conflict with C++ new on rs/6000
*/
@@ -3265,7 +3222,6 @@
test_text = 'extern int rename(const char *old, const char *new);';
};
-
/*
* Solaris 10+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
* for C99. This is wrong for C++, which needs many C99 features, but
@@ -3282,7 +3238,6 @@
test_text = "#define _RESTRICT_KYWD restrict";
};
-
/*
* Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
* themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
@@ -3297,7 +3252,8 @@
"#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]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
+ sed = "s/#define[ \t]I[ \t]\\{1,\\}_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"
@@ -3306,7 +3262,6 @@
"#define I _Imaginary_I";
};
-
/*
* Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
* extern "C" instead so libstdc++ can use it.
@@ -3323,7 +3278,6 @@
"#endif /* !defined(__cplusplus) */";
};
-
/*
* Solaris 8 PTHREAD_COND_INITIALIZER lacks the __pthread_cond_magic field.
* COND_MAGIC is only defined in <synch.h> and pollutes the namespace, so
@@ -3343,6 +3297,97 @@
'#define PTHREAD_COND_INITIALIZER {{{0}, 0}, 0} /* = DEFAULTCV */';
};
+/*
+ * Sun Solaris 2 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_const;
+ files = sys/int_const.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+ "%1\n"
+ "#define\tUINT16_C(c)\t(c)";
+ select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+ "(/\*.*\*/)\n"
+ "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+ test_text =
+ "#define UINT8_C(c) __CONCAT__(c,u)\n"
+ "/* CSTYLED */\n"
+ "#define UINT16_C(c) __CONCAT__(c,u)";
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_limits_1;
+ files = sys/int_limits.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
+ "#define\tUINT16_MAX\t(65535)";
+ select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
+ "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
+ test_text =
+ "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
+};
+
+/*
+ * Sun Solaris 2 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;
+ files = sys/int_limits.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
+ select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
+ test_text =
+ "#define INT_FAST16_MAX INT16_MAX\n"
+ "#define UINT_FAST16_MAX UINT16_MAX\n"
+ "#define INT_FAST16_MIN INT16_MIN";
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * SIZE_MAX as unsigned long.
+ */
+fix = {
+ hackname = solaris_int_limits_3;
+ files = sys/int_limits.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
+ select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
+ test_text =
+ "#define SIZE_MAX 4294967295UL";
+};
+
+/*
+ * 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 10 defines several C99 math macros in terms of
@@ -3402,7 +3447,8 @@
files = iso/math_c99.h;
c_fix = format;
c_fix_arg = "#define\tfpclassify(x) \\\n"
- " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))";
+ " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, "
+ "FP_SUBNORMAL, FP_ZERO, (x))";
c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
test_text =
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
@@ -3436,7 +3482,8 @@
files = iso/math_c99.h;
c_fix = format;
c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
- c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
+ c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) "
+ "__builtin_[a-z]+\\(y\\)\\)";
test_text =
'#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
"#undef isgreater\n"
@@ -3465,9 +3512,12 @@
c_fix = format;
c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
- "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);[ \t]*\\\\\n"
- "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
- "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*\\(-INFINITY\\);[ \t]*\\}\\)";
+ "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*="
+ "[ \t]*\\(x\\);[ \t]*\\\\\n"
+ "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+ "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
+ "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+ "\\(-INFINITY\\);[ \t]*\\}\\)";
test_text =
'#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
"#undef isinf\n"
@@ -3509,40 +3559,14 @@
'#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
"#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
"#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
- "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
+ "#define PTHREAD_MUTEX_INITIALIZER "
+ "/* = DEFAULTMUTEX */ \\\\\n"
" {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
- "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
+ "#define PTHREAD_COND_INITIALIZER "
+ "/* = DEFAULTCV */ \\\\\n"
" {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
};
-
-/*
- * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
- * fields of the pthread_rwlock_t structure, which are of type
- * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
- * defined (e.g. by -ansi) it is a union. So change the initializer
- * to "{0}" instead.
- */
-fix = {
- hackname = solaris_rwlock_init_1;
- select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
- files = pthread.h;
- mach = '*-*-solaris*';
- c_fix = format;
- c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
- "%0\n"
- "#else\n"
- "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
- "#endif";
- c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
- "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
-
- test_text =
- '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
- "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
-};
-
-
/*
* Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
* structure. As such, it need two levels of brackets, but only
@@ -3561,7 +3585,6 @@
"#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
};
-
/*
* Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
* fields of the pthread_once_t structure, which are of type
@@ -3594,104 +3617,32 @@
"#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
};
-
/*
- * Sun Solaris 2 has a version of sys/int_const.h that defines
- * UINT8_C and UINT16_C to unsigned constants.
- */
-fix = {
- hackname = solaris_int_const;
- files = sys/int_const.h;
- mach = '*-*-solaris2*';
- c_fix = format;
- c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
- "%1\n"
- "#define\tUINT16_C(c)\t(c)";
- select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
- "(/\*.*\*/)\n"
- "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
- test_text =
- "#define UINT8_C(c) __CONCAT__(c,u)\n"
- "/* CSTYLED */\n"
- "#define UINT16_C(c) __CONCAT__(c,u)";
-};
-
-
-/*
- * Sun Solaris 2 has a version of sys/int_limits.h that defines
- * UINT8_MAX and UINT16_MAX to unsigned constants.
- */
-fix = {
- hackname = solaris_int_limits_1;
- files = sys/int_limits.h;
- mach = '*-*-solaris2*';
- c_fix = format;
- c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
- "#define\tUINT16_MAX\t(65535)";
- select = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
- "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
- test_text =
- "#define UINT8_MAX (255U)\n"
- "#define UINT16_MAX (65535U)";
-};
-
-
-/*
- * Sun Solaris 2 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;
- files = sys/int_limits.h;
- mach = '*-*-solaris2*';
- c_fix = format;
- c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
- select = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
- test_text =
- "#define INT_FAST16_MAX INT16_MAX\n"
- "#define UINT_FAST16_MAX UINT16_MAX\n"
- "#define INT_FAST16_MIN INT16_MIN";
-};
-
-
-/*
- * Sun Solaris 2 has a version of sys/int_limits.h that defines
- * SIZE_MAX as unsigned long.
+ * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
+ * fields of the pthread_rwlock_t structure, which are of type
+ * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
+ * defined (e.g. by -ansi) it is a union. So change the initializer
+ * to "{0}" instead.
*/
fix = {
- hackname = solaris_int_limits_3;
- files = sys/int_limits.h;
- mach = '*-*-solaris2*';
- c_fix = format;
- c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
- select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
- test_text =
- "#define SIZE_MAX 4294967295UL";
-};
-
+ hackname = solaris_rwlock_init_1;
+ select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = pthread.h;
+ mach = '*-*-solaris*';
+ c_fix = format;
+ c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
+ "%0\n"
+ "#else\n"
+ "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
+ "#endif";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
+ "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
-/*
- * 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";
+ '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
+ "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
};
-
/*
* Sun Solaris 8 has what appears to be some gross workaround for
* some old version of their c++ compiler. G++ doesn't want it
@@ -3702,7 +3653,7 @@
files = stdio_tag.h;
select = '__cplusplus < 54321L';
- /* In Solaris 10, the code in stdio_tag.h is conditionalized on
+ /* In Solaris 10, the code in stdio_tag.h is conditionalized on
"!defined(__GNUC__)" so we no longer need to fix it. */
bypass = '__GNUC__';
sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
@@ -3710,7 +3661,6 @@
test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
};
-
/*
* On Solaris 8 and 9, __va_list needs to become a typedef for
* __builtin_va_list to make -Wmissing-format-attribute work.
@@ -3738,7 +3688,6 @@
"#endif";
};
-
/*
* a missing semi-colon at the end of the statsswtch structure definition.
*/
@@ -3751,7 +3700,6 @@
test_text = "struct statswtch {\n int boottime\n};";
};
-
/*
* Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
* On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
@@ -3775,7 +3723,6 @@
test_text = "";
};
-
/*
* Don't use or define the name va_list in stdio.h. This is for
* ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
@@ -3792,9 +3739,9 @@
files = internal/stdio_core.h;
files = internal/wchar_core.h;
bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
- /*
- * On Solaris 10, the definition in
- * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
+ /*
+ * On Solaris 10, the definition in
+ * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
* there is therefore no need for this fix there.
*/
mach = '*-*-solaris2.1[0-9]*';
@@ -3827,7 +3774,6 @@
test_text = "extern void mumble( va_list);";
};
-
/*
* Fix headers that use va_list from stdio.h to use the updated
* va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
@@ -3877,7 +3823,6 @@
test_text = "extern void mumble( va_list);";
};
-
/*
* "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
* is "!defined( __STRICT_ANSI__ )"
@@ -3940,7 +3885,6 @@
"int foo;\n#endif";
};
-
/*
* "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
* is "defined( __STRICT_ANSI__ )"
@@ -3960,7 +3904,6 @@
test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
};
-
/*
* IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
* in prototype without previous definition.
@@ -3974,7 +3917,6 @@
test_text = "extern void xdrstdio_create( struct __file_s* );";
};
-
/*
* IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
* in prototype without previous definition.
@@ -3993,7 +3935,6 @@
test_text = "extern AUTH* authdes_create( struct sockaddr* );";
};
-
/*
* Apply fix this to all OSs since this problem seems to effect
* more than just SunOS.
@@ -4021,7 +3962,6 @@
"};";
};
-
/*
* Fix bogus #ifdef on SunOS 4.1.
*/
@@ -4036,7 +3976,6 @@
test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
};
-
/*
* Fix the CAT macro in SunOS memvar.h.
*/
@@ -4055,7 +3994,6 @@
"#define CAT(a,b)\ta/**/b";
};
-
/*
* Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
* Also fix return type of {m,re}alloc in <malloc.h> on sysV68
@@ -4079,7 +4017,6 @@
"char*\trealloc();";
};
-
/*
* Check for yet more missing ';' in struct (in SunOS 4.0.x)
*/
@@ -4091,7 +4028,6 @@
test_text = "struct mumble\n int _cnt\n};";
};
-
/*
* signal.h on SunOS defines signal using (),
* which causes trouble when compiling with g++ -pedantic.
@@ -4111,7 +4047,6 @@
test_text = "void\t(*signal())();";
};
-
/*
* Correct the return type for strlen in strings.h in SunOS 4.
*/
@@ -4124,7 +4059,6 @@
test_text = " int\tstrlen(); /* string length */";
};
-
/*
* Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
* that is visible to any ANSI compiler using this include. Simply
@@ -4138,7 +4072,6 @@
test_text = "#define strlen __std_hdr_strlen\n";
};
-
/*
* Fix broken decl of getcwd present on some svr4 systems.
*/
@@ -4155,7 +4088,6 @@
test_text = "extern char* getcwd(char *, int);";
};
-
/*
* Fix broken decl of profil present on some svr4 systems.
*/
@@ -4176,7 +4108,6 @@
'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
};
-
/*
* Correct types for signal handler constants like SIG_DFL; they might be
* void (*) (), and should be void (*) (int). C++ doesn't like the
@@ -4192,7 +4123,6 @@
"#define SIG_IGN (void (*)())0\n";
};
-
/*
* Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
* function 'getrnge' in <regexp.h> before they declare it. For these
@@ -4221,7 +4151,6 @@
"{}";
};
-
/*
* Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
* in string.h on sysV68
@@ -4269,7 +4198,6 @@
"\tstrlen(), strspn();";
};
-
/*
* Fix return type of calloc, malloc, realloc, bsearch and exit
*/
@@ -4289,7 +4217,6 @@
"extern char*\tbsearch(void*,size_t,size_t);\n";
};
-
/*
* __thread is now a keyword.
*/
@@ -4321,7 +4248,6 @@
test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
};
-
/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
@@ -4343,7 +4269,6 @@
"extern int scanf( char *__format, ...);\n";
};
-
/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
@@ -4365,7 +4290,6 @@
"extern char *tempnam(char*,char*);\n";
};
-
/*
* Fix definitions of macros used by va-i960.h in VxWorks header file.
*/
@@ -4384,7 +4308,6 @@
"#define __alignof__(x) ...";
};
-
/*
* AIX and Interix headers define NULL to be cast to a void pointer,
* which is illegal in ANSI C++.
@@ -4410,7 +4333,6 @@
test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
};
-
/*
* Make VxWorks header which is almost gcc ready fully gcc ready.
*/
@@ -4451,7 +4373,6 @@
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
};
-
/*
* Fix VxWorks <time.h> to not require including <vxTypes.h>.
*/
@@ -4464,7 +4385,6 @@
test_text = "uint_t\t_clocks_per_sec;";
};
-
/*
* Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
*/
@@ -4484,7 +4404,6 @@
"# define\t__INCstath <sys/stat.h>";
};
-
/*
* Another bad dependency in VxWorks 5.2 <time.h>.
*/
@@ -4511,7 +4430,6 @@
"#define VOIDFUNCPTR (void(*)())";
};
-
/*
* There are several name conflicts with C++ reserved words in X11 header
* files. These are fixed in some versions, so don't do the fixes if
@@ -4531,7 +4449,6 @@
"} mumble;\n";
};
-
/*
* class in Xm/BaseClassI.h
*/
@@ -4547,7 +4464,6 @@
test_text = "extern mumble (int class);\n";
};
-
/*
* new in Xm/Traversal.h
*/
@@ -4571,7 +4487,6 @@
"};\nextern Wedged( Widget new, Widget old );";
};
-
/*
* Incorrect sprintf declaration in X11/Xmu.h
*/
===================================================================
@@ -361,7 +361,7 @@
static int
machine_matches( tFixDesc* p_fixd )
{
- char const ** papz_machs = p_fixd->papz_machs;
+ char const * const * papz_machs = p_fixd->papz_machs;
int have_match = BOOL_FALSE;
for (;;)
@@ -393,7 +393,7 @@
void
run_compiles (void)
{
- tFixDesc *p_fixd = fixDescList;
+ tFixDesc const * p_fixd = fixDescList;
int fix_ct = FIX_COUNT;
regex_t *p_re = XCNEWVEC (regex_t, REGEX_COUNT);
@@ -950,20 +950,15 @@
static int
start_fixer (int read_fd, tFixDesc* p_fixd, char* pz_fix_file)
{
- tCC* pz_cmd_save;
- char* pz_cmd;
+ char const * pz_cmd_save = NULL;
+ char * pz_cmd = NULL;
if ((p_fixd->fd_flags & FD_SUBROUTINE) != 0)
return internal_fix (read_fd, p_fixd);
- if ((p_fixd->fd_flags & FD_SHELL_SCRIPT) == 0)
+ if ((p_fixd->fd_flags & FD_SHELL_SCRIPT) != 0)
{
- pz_cmd = NULL;
- pz_cmd_save = NULL;
- }
- else
- {
- tSCC z_cmd_fmt[] = "file='%s'\n%s";
+ static char const z_cmd_fmt[] = "file='%s'\n%s";
pz_cmd = XNEWVEC (char, strlen (p_fixd->patch_args[2])
+ sizeof (z_cmd_fmt) + strlen (pz_fix_file));
sprintf (pz_cmd, z_cmd_fmt, pz_fix_file, p_fixd->patch_args[2]);
@@ -1226,7 +1221,7 @@
void
process (void)
{
- tFixDesc *p_fixd = fixDescList;
+ tFixDesc const * p_fixd = fixDescList;
int todo_ct = FIX_COUNT;
int read_fd = -1;
# ifndef SEPARATE_FIX_PROC