OSDN Git Service

* mkfixinc.sh: Check error code from 'cat'. Don't try running
[pf3gnuchains/gcc-fork.git] / fixincludes / inclhack.def
index 537155c..8c012f7 100644 (file)
@@ -705,6 +705,50 @@ fix = {
                "#endif";
 };
 
+/*
+ * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
+ * incorrectly, specifying less fields in the initializers than are
+ * defined in the corresponding structure types.  Use of these macros
+ * in user code results in spurious warnings.
+ */
+fix = {
+    hackname  = alpha_pthread_init;
+    files     = pthread.h;
+    select    = ' \* @\(#\).RCSfile: pthread\.h,v \$'
+                ' .Revision: 1\.1\.33\.21 \$ \(DEC\)'
+                ' .Date: 2000/08/15 15:30:13 \$';
+    mach      = "alpha*-dec-osf*";
+    sed       = "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n"
+                "s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n"
+                "s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n"
+                "s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n"
+                "s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n"
+                "s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n";
+    test_text = "/*\n"
+                " * @(#)_RCSfile: pthread.h,v \\$ "
+                "_Revision: 1.1.33.21 \\$ (DEC) "
+                "_Date: 2000/08/15 15:30:13 \\$\n"
+                " */\n"
+"#ifndef _PTHREAD_NOMETER_STATIC\n"
+"# define PTHREAD_MUTEX_INITIALIZER \\\n"
+"    {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
+"# define PTHREAD_COND_INITIALIZER \\\n"
+"    {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}\n"
+"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
+"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
+"#else\n"
+"# define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
+"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
+"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
+"    {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
+"#endif\n\n"
+"#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}\n"
+"#define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \\\n"
+"        {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}\n";
+};
 
 /*
  *  Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
@@ -978,6 +1022,23 @@ fix = {
 
 
 /*
+ * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
+ * bad __GNUC__ tests.
+ */
+
+fix = {
+  hackname  = darwin_gcc4_breakage;
+  mach      = "*-*-darwin*";
+  files     = AvailabilityMacros.h;
+  select    = "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
+  c_fix     = format;
+  c_fix_arg = "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
+  test_text = "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
+             "(__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?
  */
@@ -1082,6 +1143,22 @@ fix = {
 
 
 /*
+ *  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
+ *  (by design?) when __GNUC__ is set beyond 3.
+ */
+fix = {
+    hackname  = freebsd_gcc4_breakage;
+    mach      = *-*-freebsd*; 
+    files     = sys/cdefs.h;
+    select    = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
+    c_fix     = format;
+    c_fix_arg = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
+    test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
+};
+
+
+/*
  * Fix these files to use the types we think they should for
  * ptrdiff_t, size_t, and wchar_t.
  *
@@ -1399,6 +1476,7 @@ fix = {
     hackname = hpux8_bogus_inlines;
     files    = math.h;
     select   = inline;
+    bypass   = "__GNUG__";
     sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
            "@extern \"C\" int abs(int);@";
     sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
@@ -1447,26 +1525,6 @@ fix = {
 
 
 /*
- *  HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
- */
-fix = {
-    hackname  = hpux_maxint;
-    files     = sys/param.h;
-    files     = values.h;
-    select    = "^#[ \t]*define[ \t]+MAXINT[ \t]";
-    bypass    = "^#[ \t]*ifndef[ \t]+MAXINT";
-    test =
-    "-n \"`egrep '#[ \t]*define[ \t]+MAXINT[ \t]' sys/param.h`\"";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef MAXINT\n%0\n#endif";
-    c_fix_arg = "^#[ \t]*define[ \t]+MAXINT[ \t].*";
-
-    test_text = '#define MAXINT 0x7FFFFFFF';
-};
-
-
-/*
  *  Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
  */
 fix = {
@@ -1488,6 +1546,7 @@ fix = {
     hackname  = int_abort_free_and_exit;
     files     = stdlib.h;
     select    = "int[ \t]+(abort|free|exit)[ \t]*\\(";
+    bypass    = "_CLASSIC_ANSI_TYPES";
 
     c_fix     = format;
     c_fix_arg = "void\t%1(";
@@ -1828,31 +1887,20 @@ fix = {
 };
 
 
-/*
- *  In limits.h, put #ifndefs around things that are supposed to be defined
- *  in float.h to avoid redefinition errors if float.h is included first.
- *  On HP/UX this patch does not work, because on HP/UX limits.h uses
- *  multi line comments and the inserted #endif winds up inside the
- *  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.
+/* 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++.
  */
 fix = {
-    hackname = limits_ifndefs;
-    files  = "sys/limits.h";
-    files  = "limits.h";
-    select = "^[ \t]*#[ \t]*define[ \t]+"
-             "((FLT|DBL)_(MIN|MAX|DIG))[ \t].*";
-    bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef %1\n%0\n#endif";
-    /* Second arg is select expression */
-    test_text = " #\tdefine\tDBL_DIG \t 0  /* somthin' */";
+    hackname = linux_ia64_ucontext;
+    files = "sys/ucontext.h";
+    mach = "ia64-*-linux*";
+    select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
+             '->sc_gr\[0\]\) - \(char \*\) 0\)';
+    c_fix = format;
+    c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
+    test_text = "# define _SC_GR0_OFFSET\t\\\\\n"
+       "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
 };
 
 
@@ -1870,31 +1918,35 @@ fix = {
 };
 #endif
 
-
-/*
- *  Delete the '#define void int' line from curses.h on Lynx
+/* 
+ *  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  = lynx_void_int;
-    files     = curses.h;
-    select    = "#[ \t]*define[ \t]+void[ \t]+int[ \t]*";
+    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 = "# define\tvoid\tint \t/* curses foiled again */";
+    test_text = "#warning Using <time.h> instead of <sys/time.h>";
 };
 
 
-/*
- *  Fix fcntl prototype in fcntl.h on LynxOS.
+/* 
+ *  Add missing declaration for putenv.
  */
 fix = {
-    hackname  = lynxos_fcntl_proto;
-    files     = fcntl.h;
-    select    = "fcntl[ \t]*" '\(int, int, int\)';
+    hackname  = lynxos_missing_putenv;
+    mach      = '*-*-lynxos*';
+    files     = stdlib.h;
+    bypass    = 'putenv[ \t]*\\(';
+    select    = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
     c_fix     = format;
-    c_fix_arg = '%1...)';
-    c_fix_arg = "(fcntl[ \t]*" '\(int, int, )int\)';
-    test_text = "extern int fcntl(int, int, int);";
+    c_fix_arg = "%0\n"
+        "extern int putenv                             _AP((char *));";
+    c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
+    test_text = "extern char *getenv   _AP((const char *));";
 };
 
 
@@ -2004,23 +2056,6 @@ fix = {
 
 
 /*
- * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
- */
-fix = {
-    hackname = math_huge_val_ifndef;
-    files    = math.h;
-    files    = math/math.h;
-    select   = "define[ \t]+HUGE_VAL";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef HUGE_VAL\n%0\n#endif";
-    c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+HUGE_VAL[ \t].*";
-
-    test_text = "# define\tHUGE_VAL 3.4e+40";
-};
-
-
-/*
  *  nested comment
  */
 fix = {
@@ -2375,6 +2410,7 @@ fix = {
     files    = ods_30_compat/math.h;
     files    = oldstyle/math.h;
     select   = "inline double abs";
+    bypass   = "__GNUG__";
     sed      = "/#define.*__fp_class(a) \\\\/i\\\n"
               "#ifndef __GNUC__\n";
     sed      =
@@ -2638,21 +2674,59 @@ 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.  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.
- *  On IRIX 6.5, internal/wchar_core.h used to get its definition of
- *  va_list from stdio.h.  Since this doesn't happen any longer, use
- *  __gnuc_va_list there, too.
+ *  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
+ *  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.  On IRIX 6.5, internal/wchar_core.h used to get its
+ *  definition of va_list from stdio.h.  Since this doesn't happen any
+ *  longer, use __gnuc_va_list there, too.
  */
 fix = {
     hackname = stdio_va_list;
     files    = stdio.h;
     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.
+     * On 386BSD use __gnuc_va_list instead of _VA_LIST_.  On Tru64 UNIX V5.1A
+     * use __gnuc_va_list instead of __VA_LIST__.  We're hoping the
+     * trailing parentheses and semicolon save all other systems from this.
+     * Define __not_va_list__ (something harmless and unused)
+     * instead of va_list.
+     * Don't claim to have defined va_list.
+     */
+    sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\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"
+          "s@\\*va_list@*__not_va_list__@\n"
+          "s@ __va_list)@ __gnuc_va_list)@\n"
+          "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
+           "@typedef \\1 __not_va_list__;@\n"
+         "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
+          "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
+          "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
+          "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
+          "s@VA_LIST@DUMMY_VA_LIST@\n"
+          "s@_Va_LIST@_VA_LIST@";
+    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
+ *  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.
+ */
+fix = {
+    hackname = stdio_va_list_clients;
     files    = com_err.h;
     files    = cps.h;
     files    = curses.h;
@@ -2662,6 +2736,9 @@ fix = {
     files    = wchar.h;
     files    = curses_colr/curses.h;
     bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
+    /* Don't fix, if we use va_list from stdarg.h, or if the use is
+       otherwise protected.  */
+    bypass   = 'include <stdarg\.h>|#ifdef va_start';
 
     /*
      * Use __gnuc_va_list in arg types in place of va_list.
@@ -2817,6 +2894,7 @@ fix = {
     files    = rpc/clnt.h;
     files    = rpc/svc.h;
     files    = rpc/xdr.h;
+    bypass   = "__cplusplus";
     /*
      *  Select those files containing '(*name)()'.
      */
@@ -2875,6 +2953,7 @@ fix = {
 fix = {
     hackname = sun_malloc;
     files    = malloc.h;
+    bypass   = "_CLASSIC_ANSI_TYPES";
 
     sed   = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
     sed   = "s/int[ \t][ \t]*free/void\tfree/g";
@@ -2937,23 +3016,6 @@ fix = {
 
 
 /*
- *  Solaris math.h and floatingpoint.h define __P without protection,
- *  which conflicts with the fixproto definition.  The fixproto
- *  definition and the Solaris definition are used the same way.
- */
-fix = {
-    hackname = svr4__p;
-    files    = math.h;
-    files    = floatingpoint.h;
-    select   = "^#define[ \t]+__P.*";
-    c_fix     = format;
-    c_fix_arg = "#ifndef __P\n%0\n#endif";
-
-    test_text = "#define __P(a) a";
-};
-
-
-/*
  *  Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
  *  that is visible to any ANSI compiler using this include.  Simply
  *  delete the lines that #define some string functions to internal forms.
@@ -3378,6 +3440,7 @@ fix = {
     hackname = sysv68_string;
     files    = testing.h;
     files    = string.h;
+    bypass   = "_CLASSIC_ANSI_TYPES";
 
     sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
     sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
@@ -3419,6 +3482,7 @@ fix = {
 fix = {
     hackname = sysz_stdlib_for_sun;
     files    = stdlib.h;
+    bypass   = "_CLASSIC_ANSI_TYPES";
 
     select    = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
     c_fix     = format;
@@ -3806,25 +3870,6 @@ fix = {
 
 
 /*
- *  Fix multiple defines for NULL.  Sometimes, we stumble into \r\n
- *  terminated lines, so accommodate these.  Test both ways.
- *  Don't bother to reproduce the \r\n termination, as GCC has to
- *  recognize \n termination anyway.
- */
-fix = {
-    hackname  = undefine_null;
-    select    = "^#[ \t]*define[ \t]+NULL[ \t]";
-    bypass    = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
-
-    c_fix     = format;
-    c_fix_arg = "#ifndef NULL\n#define NULL%1\n#endif\n";
-    c_fix_arg = "^#[ \t]*define[ \t]+NULL([^\r\n]+)[\r]*\n";
-
-    test_text = "#define NULL 0UL\r\n"
-                "#define NULL\t((void*)0)\n";
-};
-
-/*
  * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
  * which must be replaced by __restrict__ for GCC.
  */
@@ -3909,6 +3954,8 @@ fix = {
     files     = sys/dir.h;
     files     = sys/param.h;
     files     = sys/types.h;
+    /* avoid changing C++ friendly NULL */
+    bypass    = __cplusplus;
     select    = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
     c_fix     = format;
     c_fix_arg = "#define NULL 0";