aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc/inclhack.def
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fixinc/inclhack.def')
-rw-r--r--gcc/fixinc/inclhack.def545
1 files changed, 483 insertions, 62 deletions
diff --git a/gcc/fixinc/inclhack.def b/gcc/fixinc/inclhack.def
index f332965da06..d62c12c00fa 100644
--- a/gcc/fixinc/inclhack.def
+++ b/gcc/fixinc/inclhack.def
@@ -109,7 +109,7 @@ fix = {
* the wrapper, this will follow the #include_next chain until
* we arrive at the real <asm/posix_types.h>.
*/
- replace = <<- _EOF_
+ replace = <<- _EndOfHeader_
/* This file fixes a bug in the __FD_ZERO macro
for older versions of the Linux kernel. */
#ifndef _POSIX_TYPES_H_WRAPPER
@@ -130,7 +130,7 @@ fix = {
#define _POSIX_TYPES_H_WRAPPER
#endif /* _POSIX_TYPES_H_WRAPPER */
- _EOF_;
+ _EndOfHeader_;
};
@@ -297,19 +297,18 @@ fix = {
/*
* Completely replace <sys/byteorder.h>; with a file that implements gcc's
- * optimized byteswapping. Restricted to "SVR4" machines until either
- * it is shown to be safe to replace this file always, or we get bolder ;-)
+ * optimized byteswapping.
*/
fix = {
hackname = AAB_svr4_replace_byteorder;
-#ifndef SVR5
- mach = "*-*-sysv4*";
- mach = "i[34567]86-*-sysv5*";
- mach = "i[34567]86-*-udk*";
- mach = "i[34567]86-*-solaris2.[0-4]";
- mach = "powerpcle-*-solaris2.[0-4]";
- mach = "sparc-*-solaris2.[0-4]";
-#endif /* SVR5 */
+ mach = "*-*-sysv4*";
+ mach = "i[34567]86-*-sysv5*";
+ mach = "i[34567]86-*-sco3.2v5*";
+ mach = "i[34567]86-*-udk*";
+ mach = "i[34567]86-*-solaris2.[0-4]";
+ mach = "powerpcle-*-solaris2.[0-4]";
+ mach = "sparc-*-solaris2.[0-4]";
+ mach = "i[34567]86-sequent-ptx*";
files = sys/byteorder.h;
replace = '#ifndef _SYS_BYTEORDER_H
\#define _SYS_BYTEORDER_H
@@ -360,9 +359,8 @@ htonl (unsigned long __arg)
{
register unsigned long __result;
- __asm__ ("xchg%B0 %b0,%h0
- ror%L0 $16,%0
- xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
+ __asm__ ("xchg%B0 %b0,%h0 ; ror%L0 $16,%0 ; xchg%B0 %b0,%h0" \
+ : "=q" (__result) : "0" (__arg));
return __result;
}
@@ -599,6 +597,22 @@ fix = {
/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/stat.h>.
+ */
+fix = {
+ hackname = alpha___extern_prefix;
+ files = sys/stat.h;
+ select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
+
+ mach = "alpha*-dec-osf5*";
+ c_fix = format;
+ c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
+
+ test_text = "# if defined(__DECC)";
+};
+
+
+/*
* Fix assert macro in assert.h on Alpha OSF/1.
* The superfluous int cast breaks C++.
*/
@@ -640,6 +654,27 @@ fix = {
/*
+ * Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
+ */
+fix = {
+ hackname = alpha_pthread_gcc;
+ files = pthread.h;
+ select = "#else\n# error <pthread.h>: unrecognized compiler.";
+
+ mach = "alpha*-dec-osf*";
+ c_fix = format;
+ c_fix_arg = "#elif defined (__GNUC__)\n"
+ "# define _PTHREAD_ENV_GCC\n"
+ "%0";
+
+ test_text = "# define _PTHREAD_ENV_INTELC\n"
+ "#else\n"
+ "# error <pthread.h>: unrecognized compiler.\n"
+ "#endif";
+};
+
+
+/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
*/
fix = {
@@ -726,6 +761,7 @@ fix = {
test_text = "# define bool\t char \n";
};
+
fix = {
hackname = avoid_bool_type;
files = curses.h;
@@ -742,15 +778,23 @@ fix = {
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.
+ * Don't do this for headers that are smart enough to do the right
+ * thing (recent [n]curses.h and Xlib.h).
+ * Don't do it for <linux/nls.h> which is never used from C++ anyway,
+ * and will be broken by the edit.
*/
fix = {
hackname = avoid_wchar_t_type;
select = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
+ bypass = "we must use the C\\+\\+ compiler's type";
+ bypass = "_LINUX_NLS_H";
+ bypass = "XFree86: xc/lib/X11/Xlib\\.h";
c_fix = format;
c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
@@ -758,6 +802,7 @@ fix = {
test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
};
+
/*
* Fix #defines under Alpha OSF/1:
* The following files contain '#pragma extern_prefix "_FOO"' followed by
@@ -988,6 +1033,7 @@ fix = {
"extern __DJ_wint_t x;\n";
};
+
/*
* Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
*/
@@ -1142,6 +1188,69 @@ fix = {
/*
+ * Fix hpux 10.X missing ctype declarations 1
+ */
+fix = {
+ hackname = hpux10_ctype_declarations1;
+ files = ctype.h;
+ select = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "#ifdef _PROTOTYPES\n"
+ "extern int __tolower(int);\n"
+ "extern int __toupper(int);\n"
+ "#else /* NOT _PROTOTYPES */\n"
+ "extern int __tolower();\n"
+ "extern int __toupper();\n"
+ "#endif /* _PROTOTYPES */\n\n"
+ "%0\n";
+
+ test_text = "# define _toupper(__c) __toupper(__c)\n";
+};
+
+
+/*
+ * Fix hpux 10.X missing ctype declarations 2
+ */
+fix = {
+ hackname = hpux10_ctype_declarations2;
+ files = ctype.h;
+ select = "^# if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
+ bypass = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(";
+ c_fix = format;
+ c_fix_arg = "%0\n\n"
+ "#ifdef _PROTOTYPES\n"
+ " extern int _isalnum(int);\n"
+ " extern int _isalpha(int);\n"
+ " extern int _iscntrl(int);\n"
+ " extern int _isdigit(int);\n"
+ " extern int _isgraph(int);\n"
+ " extern int _islower(int);\n"
+ " extern int _isprint(int);\n"
+ " extern int _ispunct(int);\n"
+ " extern int _isspace(int);\n"
+ " extern int _isupper(int);\n"
+ " extern int _isxdigit(int);\n"
+ "# else /* not _PROTOTYPES */\n"
+ " extern int _isalnum();\n"
+ " extern int _isalpha();\n"
+ " extern int _iscntrl();\n"
+ " extern int _isdigit();\n"
+ " extern int _isgraph();\n"
+ " extern int _islower();\n"
+ " extern int _isprint();\n"
+ " extern int _ispunct();\n"
+ " extern int _isspace();\n"
+ " extern int _isupper();\n"
+ " extern int _isxdigit();\n"
+ "#endif /* _PROTOTYPES */\n";
+
+ test_text = "# if defined(_SB_CTYPE_MACROS) && !defined(__lint)\n"
+ " extern unsigned int *__SB_masks;\n";
+};
+
+
+/*
* Make sure hpux defines abs in header.
*/
fix = {
@@ -1239,6 +1348,25 @@ fix = {
/*
+ * Fix hpux 11.00 broken snprintf declaration
+ * (third argument is char *, needs to be const char * to prevent
+ * spurious warnings with -Wwrite-strings or in C++).
+ */
+fix = {
+ hackname = hpux11_snprintf;
+ files = stdio.h;
+ select = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
+ ' *(char *\*, *\.\.\.\);)';
+ c_fix = format;
+ c_fix_arg = '%1 const %3';
+
+ test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
+ "extern int snprintf(char *, __size_t, char *, ...);\n"
+ "extern int snprintf(char *, _hpux_size_t, char *, ...);";
+};
+
+
+/*
* get rid of bogus inline definitions in HP-UX 8.0
*/
fix = {
@@ -1256,6 +1384,43 @@ fix = {
/*
+ * Fix hpux broken ctype macros
+ */
+fix = {
+ hackname = hpux_ctype_macros;
+ files = ctype.h;
+ select = '((: |\()__SB_masks \? )'
+ '(__SB_masks\[__(alnum|c)\] & _IS)';
+ c_fix = format;
+ c_fix_arg = "%1(int)%3";
+
+ test_text = ": __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
+ "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
+};
+
+
+/*
+ * HP-UX long_double
+ */
+fix = {
+ hackname = hpux_long_double;
+ files = stdlib.h;
+ select = "extern[ \t]long_double[ \t]strtold";
+ bypass = "long_double_t";
+ sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
+ sed = "s/long_double/long double/g";
+
+ test_text = "# ifndef _LONG_DOUBLE\n"
+ "# define _LONG_DOUBLE\n"
+ " typedef struct {\n"
+ " unsigned int word1, word2, word3, word4;\n"
+ " } long_double;\n"
+ "# endif /* _LONG_DOUBLE */\n"
+ "extern long_double strtold(const char *, char **);\n";
+};
+
+
+/*
* HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
*/
fix = {
@@ -1367,6 +1532,70 @@ fix = {
/*
+ * 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
+ * functions.
+ *
+ * This was probably introduced around IRIX 6.5.18
+ */
+fix = {
+ hackname = irix___generic1;
+ files = internal/math_core.h;
+ mach = "mips-sgi-irix6.5";
+ select = "#define ([a-z]+)\\(x\\) *__generic.*";
+
+ c_fix = format;
+ c_fix_arg = "extern int %1(double);\n"
+ "extern int %1f(float);\n"
+ "extern int %1l(long double);\n"
+ "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n"
+ " : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
+ " : _%1l(x))\n";
+
+ 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. */
+fix = {
+ hackname = irix___generic2;
+ files = internal/math_core.h;
+ mach = "mips-sgi-irix6.5";
+ select = "#define ([a-z]+)\\(x,y\\) *__generic.*";
+
+ c_fix = format;
+ c_fix_arg = "#define %1(x,y) \\\n"
+ " ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n"
+ " : (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)";
+};
+
+
+/*
* IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
* that causes the assembly preprocessor to complain about an
* unterminated character constant.
@@ -1397,22 +1626,65 @@ fix = {
/*
- * IRIX 5.x's stdio.h declares some functions that take a va_list as
+ * IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
+ * Various socket function prototypes use different types instead,
+ * depending on the API in use (BSD, XPG4/5), but the socklen_t
+ * definition doesn't reflect this (SGI Bug Id 864477, fixed in
+ * IRIX 6.5.19).
+ */
+fix = {
+ hackname = irix_socklen_t;
+ files = sys/socket.h;
+ select = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "%1"
+ "#if _NO_XOPEN4 && _NO_XOPEN5\n"
+ "typedef int socklen_t;\n"
+ "#else\n"
+ "%2\n"
+ "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
+
+ test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
+};
+
+/*
+ * IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
+ * some functions that take a va_list as
* taking char *. However, GCC uses void * for va_list, so
* calling vfprintf with a va_list fails in C++. */
fix = {
hackname = irix_stdio_va_list;
files = stdio.h;
+ files = internal/stdio_core.h;
- select = '(printf\(.*), /\* va_list \*/ char \*';
+ select = '/\* va_list \*/ char \*';
c_fix = format;
- c_fix_arg = "%1, __gnuc_va_list";
+ c_fix_arg = "__gnuc_va_list";
test_text =
"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.
+ */
+fix = {
+ hackname = irix_wcsftime;
+ files = internal/wchar_core.h;
+ select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
+
+ test_text = "#if _NO_XOPEN5\n"
+ "extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
+};
+
+/*
* Fixing ISC fmod declaration
*/
fix = {
@@ -1538,12 +1810,16 @@ fix = {
* comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
* we find a #ifndef FLT_MIN we assume that all the required #ifndefs
* are there, and we do not add them ourselves.
+ *
+ * QNX Software Systems also guards the defines, but doesn't define
+ * FLT_MIN. Therefore, bypass the fix for *either* guarded FLT_MIN
+ * or guarded FLT_MAX.
*/
fix = {
hackname = limits_ifndefs;
files = "sys/limits.h";
files = "limits.h";
- bypass = "ifndef[ \t]+FLT_MIN";
+ bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
c_fix = format;
c_fix_arg = "#ifndef %1\n%0\n#endif";
@@ -1805,6 +2081,7 @@ fix = {
"#define OPEN_MAX 20 /* Max, Max, ... */\n";
};
+
/*
* fix bogus recursive stdlib.h in NEWS-OS 4.0C
*/
@@ -1901,6 +2178,31 @@ fix = {
/*
+ * 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)";
+};
+
+
+/*
* sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
* defining regex.h related types. This causes libg++ build and usage
* failures. Fixing this correctly requires checking and modifying 3 files.
@@ -1975,6 +2277,31 @@ fix = {
/*
+ * Fix casts as lvalues in glibc's <rpc/xdr.h>.
+ */
+fix = {
+ hackname = rpc_xdr_lvalue_cast_a;
+ files = rpc/xdr.h;
+ select = "#define[ \t]*IXDR_GET_LONG.*\\\\\n.*__extension__.*";
+ c_fix = format;
+ c_fix_arg = "#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))";
+ test_text = "#define IXDR_GET_LONG(buf) \\\\\n"
+ "\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
+};
+
+
+fix = {
+ hackname = rpc_xdr_lvalue_cast_b;
+ 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)))";
+ test_text = "#define IXDR_PUT_LONG(buf, v) \\\\\n"
+ "\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
+};
+
+
+/*
* function class(double x) conflicts with C++ keyword on rs/6000
*/
fix = {
@@ -2020,6 +2347,100 @@ fix = {
/*
+ * On OpenServer and on UnixWare 7, <math.h> uses the native compiler
+ * __builtin_generic. We fix that usage to use the GCC equivalent.
+ * It also has a plethora of inline functions that conflict with libstdc++.
+ */
+fix = {
+ hackname = sco_math;
+ files = math.h;
+ files = posix/math.h;
+ files = ansi/math.h;
+ files = xpg4/math.h;
+ files = xpg4v2/math.h;
+ files = xpg4plus/math.h;
+ files = ods_30_compat/math.h;
+ files = oldstyle/math.h;
+ select = "__builtin_generic";
+ sed = "/#define.*__fp_class(a) \\\\/i\\\n"
+ "#ifndef __GNUC__\n";
+ sed =
+"/.*__builtin_generic/a\\\n"
+"#else\\\n"
+"#define __fp_class(a) \\\\\\\n"
+" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
+" __fpclassifyl(a), \\\\\\\n"
+" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
+" __fpclassifyf(a),__fpclassify(a)))\\\n"
+"#endif";
+
+ sed = "/extern \"C\\+\\+\"/N;"
+ "/inline double abs/i\\\n"
+ "#ifndef __GNUC__\n";
+ sed = "/inline long double trunc/N;"
+ "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
+ "#endif /* ! __GNUC__ */";
+
+ test_text =
+ "#define __fp_class(a) \\\\\n"
+ " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
+
+};
+
+
+/*
+ * On SCO OpenServer prior to 5.0.7MP1, <sys/regset.h> and <ieeefp.h>
+ * have a clash on struct _fpstate and struct fpstate.
+ */
+fix = {
+ hackname = sco_regset;
+ files = sys/regset.h;
+ mach = "*-*-sco3.2v5*";
+ select = "(struct[ \t]+_*)fpstate";
+ c_fix = format;
+ c_fix_arg = "%1rsfpstate";
+
+ test_text =
+ "union u_fps { struct\tfpstate { int whatever; } };\n"
+ "union _u_fps { struct _fpstate { int whatever; } };\n";
+};
+
+
+/*
+ * The string.h header file on SCO Open Server has some inline C++ functions
+ * that confuse and upset libstdc++ horribly. Protect them from being defined
+ * when using GCC.
+ */
+fix = {
+ hackname = sco_string;
+ files = ansi/string.h;
+ files = posix/string.h;
+ files = xpg4/string.h;
+ files = xpg4v2/string.h;
+ files = xpg4plus/string.h;
+ files = ods_30_compat/string.h;
+ files = oldstyle/string.h;
+ files = string.h;
+ mach = "*-*-sco3.2v5*";
+ select = "inline char";
+ sed = "/extern \"C\\+\\+\"/N;"
+ "/inline void.*memchr/i\\\n"
+ "#ifndef __GNUC__\n";
+ sed = "/return.*strstr/N;"
+ "/return.*strstr.*}/a\\\n"
+ "#endif /* ! __GNUC__ */";
+
+ test_text =
+ "extern \"C++\" {\n"
+ "inline void *memchr(void *__1, int __2, size_t __3)\n"
+ " { return (void *)memchr((const void *)__1, __2, __3); }\n"
+ "inline char *strstr(char *__1, const char *__2)\n"
+ " { return (char *)strstr((const char *)__1, __2); }\n"
+ "}\n";
+};
+
+
+/*
* The static functions lstat() and fchmod() in <sys/stat.h>
* cause G++ grief since they're not wrapped in "if __cplusplus".
*
@@ -2046,7 +2467,7 @@ fix = {
"#ifdef __STDC__\n"
"static int\tstat(const char *__f, struct stat *__p) {\n"
"\treturn __stat32(__f, __p);\n"
- "}\n\n# else /* !__STDC__ */\n"
+ "}\n\n# else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
"static int\tstat(__f, __p)\n"
"\tchar *__f;\n"
@@ -2076,6 +2497,26 @@ fix = {
/*
+ * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
+ * incorrectly, so we replace them with versions that correspond to
+ * the definition. We also explicitly name this fix "1" and the next
+ * fix "2" because this one does not deal with the last field. This
+ * fix needs to run before the next.
+ */
+fix = {
+ hackname = solaris_mutex_init_1;
+ select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
+ files = pthread.h;
+ sed = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
+ "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
+ test_text =
+ '#ident "@(#)pthread.h 1.16 97/05/05 SMI"'"\n"
+ "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
+ "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
+};
+
+
+/*
* Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
* "0" for the last field of the pthread_mutex_t structure, which is
* of type upad64_t, which itself is typedef'd to int64_t, but with
@@ -2083,7 +2524,7 @@ fix = {
* initializer to "{0}" instead
*/
fix = {
- hackname = solaris_mutex_init;
+ hackname = solaris_mutex_init_2;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h;
c_fix = format;
@@ -2127,7 +2568,8 @@ fix = {
fix = {
hackname = solaris_widec;
files = widec.h;
- mach = '*-*-solaris2.[0-5]*';
+ mach = '*-*-solaris2.[0-5]';
+ mach = '*-*-solaris2.[0-5].*';
bypass = "include.*wchar\\.h";
select = "#include <euc.h>";
c_fix = format;
@@ -2135,35 +2577,6 @@ fix = {
test_text = "#include <euc.h>";
};
-/*
- * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
- */
-#ifdef SONY
-fix = {
- hackname = sony_ctype;
- files = ctype.h;
- test = " -x /bin/sony";
- test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
- sed = "s/__ctype/_ctype/g";
-};
-#endif
-
-
-/*
- * Sony NEWSOS 5.0 does not support the complete ANSI C standard.
- */
-#ifdef SONY
-fix = {
- hackname = sony_stdio;
- files = stdio.h;
- test = " -x /bin/sony";
- test = " ! -z \"`if /bin/sony ; then echo true ; fi`\"";
- sed = "s/__filbuf/_filbuf/g\n"
- "s/__flsbuf/_flsbuf/g\n"
- "s/__iob/_iob/g";
-};
-#endif
-
/*
* Add a `static' declaration of `getrnge' into <regexp.h>.
@@ -2217,13 +2630,18 @@ fix = {
/*
* Don't use or define the name va_list in stdio.h.
- * This is for ANSI and also to interoperate properly with gcc's varargs.h.
- * Note _BSD_VA_LIST_ is dealt with elsewhere.
+ * This is for ANSI and also to interoperate properly with gcc's
+ * varargs.h. Note _BSD_VA_LIST_ is dealt with elsewhere. The
+ * presence of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken
+ * to indicate that the header knows what it's doing -- under SUSv2,
+ * stdio.h is required to define va_list, and we shouldn't break that.
*/
fix = {
hackname = stdio_va_list;
files = stdio.h;
- bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list';
+ files = internal/stdio_core.h;
+ files = internal/wchar_core.h;
+ bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
/*
* Use __gnuc_va_list in arg types in place of va_list.
@@ -2234,8 +2652,9 @@ fix = {
* instead of va_list.
* Don't claim to have defined va_list.
*/
- sed = "s@ va_list @ __gnuc_va_list @\n"
- "s@ va_list)@ __gnuc_va_list)@\n"
+ sed = "s@[ \t]va_list @ __gnuc_va_list @\n"
+ "s@[ \t]va_list)@ __gnuc_va_list)@\n"
+ "s@(va_list)&@(__gnuc_va_list)\\&@\n"
"s@ _VA_LIST_));@ __gnuc_va_list));@\n"
"s@ __VA_LIST__));@ __gnuc_va_list));@\n"
"s@ va_list@ __not_va_list__@\n"
@@ -2265,6 +2684,9 @@ fix = {
"|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
/* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
bypass = 'GNU and MIPS C compilers define __STDC__ differently';
+ /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
+ is not defined by GCC, so it is safe. */
+ bypass = '__SCO_VERSION__.*__STDC__ != 1';
c_test = stdc_0_in_system_headers;
c_fix = format;
@@ -2531,14 +2953,13 @@ fix = {
* that is visible to any ANSI compiler using this include. Simply
* delete the lines that #define some string functions to internal forms.
*/
-#ifdef SVR4
fix = {
hackname = svr4_disable_opt;
files = string.h;
select = '#define.*__std_hdr_';
sed = '/#define.*__std_hdr_/d';
+ test_text = "#define strlen __std_hdr_strlen\n";
};
-#endif
/*
@@ -2684,8 +3105,8 @@ fix = {
fix = {
hackname = svr4_mach_defines;
files = ieeefp.h;
- select = "#define[ \t]*__(i386|i860|mips|sparc|m88k|m68k)[ \t]";
- sed = "/#define[ \t]*__\\(i386|i860|mips|sparc|m88k|m68k\\)[ \t]/d";
+ select = "#define[ \t]*__(i386|mips|sparc|m88k|m68k)[ \t]";
+ sed = "/#define[ \t]*__\\(i386|mips|sparc|m88k|m68k\\)[ \t]/d";
};
#endif
@@ -3111,7 +3532,7 @@ fix = {
test_text =
"@(#)stat.h 6.1 (ULTRIX)\n"
"#define S_IFPORT S_IFIFO\n"
- "\tfstat(),\n";
+ "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
};
@@ -3444,7 +3865,7 @@ fix = {
sed = "s/Widget new,/Widget c_new,/g";
test_text =
"struct wedge {\n"
- " Widget\told, new; /* fix the new */\n"
+ " Widget\told, new; /* fixinc check FAILS ON BSD */\n"
"};\nextern Wedged( Widget new, Widget old );";
};