OSDN Git Service

snprintf alphabetically precedes uint
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / inclhack.def
index 76df445..432d016 100644 (file)
@@ -221,8 +221,9 @@ fix = {
 
 
 /*
- *  Completely replace <sys/byteorder.h>; with a file that implements gcc's
- *  optimized byteswapping.
+ *  Completely replace <sys/byteorder.h> with a file that implements gcc's
+ *  optimized byteswapping.  (The original probably implemented some
+ *  incompatible optimized byteswapping.)
  */
 fix = {
     hackname = AAB_svr4_replace_byteorder;
@@ -233,6 +234,7 @@ fix = {
     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  = <<-  _EndOfHeader_
        #ifndef _SYS_BYTEORDER_H
@@ -578,6 +580,46 @@ fix = {
 
 
 /*
+ *  Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
+ */
+fix = {
+    hackname  = alpha_pthread;
+    files     = pthread.h;
+    select    = "(#[ \t]*if defined \\(_PTHREAD_ENV_DECC\\) || defined \\(_PTHREAD_ENV_EPCC\\))\n"
+               "(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
+
+    mach      = "alpha*-dec-osf*";
+    c_fix     = format;
+    c_fix_arg = "%1 || defined (__PRAGMA_EXTERN_PREFIX)\n%2";
+
+    test_text = "#  if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
+               "#   define _PTHREAD_USE_PTDNAM_\n"
+               "#  endif";
+};
+
+
+/*
+ *  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
  *  And OpenBSD.
  */
@@ -604,7 +646,7 @@ fix = {
     files     = tinfo.h;
 
     select    = "#[ \t]*define[ \t]+bool[ \t]";
-    bypass    = "we must use the C\\+\\+ compiler's type";
+    bypass    = "__cplusplus";
 
     c_fix     = format;
     c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
@@ -622,7 +664,7 @@ fix = {
     files    = tinfo.h;
 
     select    = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;";
-    bypass    = "we must use the C\\+\\+ compiler's type";
+    bypass    = "__cplusplus";
 
     c_fix     = format;
     c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
@@ -644,7 +686,7 @@ fix = {
     hackname = avoid_wchar_t_type;
 
     select    = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
-    bypass    = "we must use the C\\+\\+ compiler's type";
+    bypass    = "__cplusplus";
     bypass    = "_LINUX_NLS_H";
     bypass    = "XFree86: xc/lib/X11/Xlib\\.h";
 
@@ -764,21 +806,25 @@ fix = {
  *  This conflicts with C99.  Discovered on AIX.
  *  SunOS4 has its cabs() declaration followed by a comment which
  *  terminates on the following line.
+ *  Darwin hides its broken cabs in architecture-specific subdirs.
  */
 fix = {
     hackname = broken_cabs;
-    files  = "math.h";
-    select = '^extern[ \t]+double[ \t]+cabs';
+    files    = "math.h";
+    files    = "architecture/ppc/math.h";
+    files    = "architecture/i386/math.h";
+    select   = '^extern[ \t]+double[ \t]+cabs';
 
     c_fix     = format;
     c_fix_arg = "";
-    c_fix_arg = "^extern[ \t]+double[ \t]+cabs\\((struct dbl_hypot|)\\);";
+    c_fix_arg = "^extern[ \t]+double[ \t]+cabs[ \t]*\\([^\\)]*\\);";
 
     test_text = "#ifdef __STDC__\n"
                 "extern     double   cabs(struct dbl_hypot);\n"
                 "#else\n"
                 "extern     double   cabs();\n"
                 "#endif\n"
+                "extern double cabs ( _Complex z );\n"
                 "extern double cabs(); /* This is a comment\n"
                 "                         and it ends here. */";
 };
@@ -1165,6 +1211,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 *, ...);";
+};
+
+
+/*
  * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
  * of UINT32_C has undefined behavior according to ISO/ANSI:
  * the arguments to __CONCAT__ are not macro expanded before the
@@ -1455,9 +1520,9 @@ fix = {
     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 * );";
 };
@@ -1627,6 +1692,21 @@ fix = {
 
 
 /*
+ * Apparently some SVR4 systems typedef longlong_t to long ?
+ */
+#ifdef SVR4
+fix = {
+    hackname  = longlong_t;
+    select    = "typedef[ \t]+(unsigned[ \t]+)?long[ \t]+(u_)?longlong_t";
+    c_fix     = format;
+    c_fix_arg = "typedef %1long long %2longlong_t";
+    test_text = "typedef long longlong_t\n"
+                "typedef unsigned long u_longlong_t";
+};
+#endif
+
+
+/*
  *  Delete the '#define void int' line from curses.h on Lynx
  */
 fix = {
@@ -1917,6 +1997,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.
@@ -1976,6 +2081,30 @@ fix = {
 
 
 /*
+ * On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
+ * on the P5. This is not used by anything else so we ifdef it out.
+ * Current GCC doesn't seem to complain about the asm, though.
+ */
+#ifdef PTX
+fix = {
+    hackname  = ptx_sys_mc_param_h;
+    files     = sys/mc_param.h;
+    sed       = "/__asm/,/}/{"
+                  "/__asm/i\\\n"
+                  "#if !defined (__GNUC__) && !defined (__GNUG__)\n"
+                  "/}/a\\\n"
+                  "#endif\n"
+                "}";
+    test_text = "__asm\n"
+                "int _CPUID()\n"
+                "{\n"
+                "   non-GNU assembly here\n"
+                "}";
+};
+#endif
+
+
+/*
  *  Fix return type of fread and fwrite on sysV68
  */
 fix = {
@@ -2198,8 +2327,8 @@ fix = {
                 "#else\n"
                 "%1, {0}}%3\n"
                 "#endif";
-    c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+{.*)"
-                ",[ \t]*0}" "(|[ \t].*)$";
+    c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+\\{.*)"
+                ",[ \t]*0\\}" "(|[ \t].*)$";
     test_text =
     '#ident "@(#)pthread.h  1.26  98/04/12 SMI"'"\n"
     "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
@@ -2272,7 +2401,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;
@@ -2282,25 +2412,6 @@ fix = {
 
 
 /*
- *  Add a `static' declaration of `getrnge' into <regexp.h>.
- *
- *  Don't do this if there is already a `static void getrnge' declaration
- *  present, since this would cause a redeclaration error.  Solaris 2.x has
- *  such a declaration.
- */
-#ifdef SVR4
-fix = {
-    hackname = static_getrnge;
-    files    = regexp.h;
-    bypass   = "static void getrnge";
-    sed      = "/^static int[ \t]*size;/c\\\n"
-               "static int      size ;\\\n\\\n"
-               "static int getrnge ();";
-};
-#endif
-
-
-/*
  *  a missing semi-colon at the end of the statsswtch structure definition.
  */
 fix = {
@@ -2360,7 +2471,6 @@ fix = {
      */
     sed = "s@ va_list @ __gnuc_va_list @\n"
           "s@ va_list)@ __gnuc_va_list)@\n"
-         "s@va_list _ap;@__gnuc_va_list _ap;@\n"
          "s@(va_list)&@(__gnuc_va_list)\\&@\n"
           "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
           "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
@@ -2371,6 +2481,7 @@ fix = {
            "@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@";
@@ -2783,11 +2894,21 @@ fix = {
 
 
 /*
- *  set ifdef _KERNEL
+ *  Wrap some files on System V r4 and DYNIX/ptx systems with
+ *  #ifdef _KERNEL, presumably to prevent kernel headers from
+ *  leaking into userspace.  This may not be necessary at all,
+ *  but it was in the old scripts, so it seems safest to keep it for now.
  */
-#ifdef SVR4
 fix = {
-    hackname = svr4_kernel;
+    /* Can't name this with _kernel, or the test case will hit the bypass! */
+    hackname = svr4_krnl;
+    /* Since I'm rather unsure about the validity of this, limit it
+     * to the specific systems it was operating on before.  It should
+     * also be bypassed for i?86-*-sysv4.3uw2, by that rule, but I didn't
+     * see an easy way to do that.  Hopefully it will be harmless
+     * in any case. -- Nathanael */
+    mach     = '*-*-sysv4*';
+    mach     = 'i?86-sequent-ptx*';
     files    = fs/rfs/rf_cache.h;
     files    = sys/erec.h;
     files    = sys/err.h;
@@ -2796,14 +2917,21 @@ fix = {
     files    = sys/map.h;
     files    = sys/cmn_err.h;
     files    = sys/kdebugger.h;
+
+    /* This bypass will match _KERNEL, __KERNEL, __KERNEL__, etc.
+     * It will also match SVR4_KERNEL_CHECK, which means that the
+     * testsuite case will always be bypassed.  Which is fine with me. */
     bypass   = '_KERNEL';
-    c_fix     = wrap;
 
+    c_fix     = wrap;
     c_fix_arg = "#ifdef _KERNEL\n";
     c_fix_arg = "#endif /* _KERNEL */\n";
+
+    /* There's no reasonable test for this given that we don't know exactly
+     * what problem inspired it in the first place. */
     test_text = "";
 };
-#endif
+
 
 /*
  *  Delete any #defines of `__i386' which may be present in <ieeefp.h>.  They
@@ -2867,6 +2995,34 @@ fix = {
 
 
 /*
+ * Some SVR4 systems supposedly use these non-ANSI preprocessor directives.
+ */
+#ifdef SVR4
+fix = {
+    hackname  = svr4_preproc_lint_on;
+    select    = '#lint\(on\)';
+    c_fix     = format;
+    c_fix_arg = 'defined(lint)';
+    test_text = "#if #lint(on)";
+};
+fix = {
+    hackname  = svr4_preproc_lint_off;
+    select    = '#lint\(off\)';
+    c_fix     = format;
+    c_fix_arg = '!defined(lint)';
+    test_text = "#if #lint(off)";
+};
+fix = {
+    hackname  = svr4_preproc_machine;
+    select    = '#(machine|system|cpu)\(([^)]*)\)';
+    c_fix     = format;
+    c_fix_arg = 'defined(__%1__)';
+    test_text = "#if #machine(i386) || #system(vax) || #cpu(sparc)";
+};
+#endif
+
+
+/*
  *   Fix broken decl of profil present on some svr4 systems.
  */
 fix = {
@@ -2952,6 +3108,22 @@ fix = {
 };
 #endif
 
+
+/*
+ * Correct types for signal handler constants like SIG_DFL; they might be
+ * void (*) (), and should be void (*) (int).  C++ doesn't like the
+ * old style.
+ */
+fix = {
+    hackname = svr4_sighandler_type;
+    files = sys/signal.h;
+    select = 'void *\(\*\)\(\)';
+    c_fix = format;
+    c_fix_arg = "void (*)(int)";
+    test_text = "#define SIG_DFL (void(*)())0\n"
+                "#define SIG_IGN (void (*)())0\n";
+};
+
 /*
  *  Put storage class at start of decl, to avoid warning.
  */
@@ -2966,6 +3138,35 @@ fix = {
 
 
 /*
+ *  Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
+ *  function 'getrnge' in <regexp.h> before they declare it.  For these
+ *  systems add a 'static int' declaration of 'getrnge' into <regexp.h>
+ *  early on.
+ *
+ *  'getrnge' traditionally manipulates a file-scope global called 'size',
+ *  so put the declaration right after the declaration of 'size'.
+ *
+ *  Don't do this if there is already a `static void getrnge' declaration
+ *  present, since this would cause a redeclaration error.  Solaris 2.x has
+ *  such a declaration.
+ */
+fix = {
+    hackname  = svr4_undeclared_getrnge;
+    files     = regexp.h;
+    select    = "getrnge";
+    bypass    = "static void getrnge";
+    c_fix     = format;
+    c_fix_arg = "%0\n"
+                "static int getrnge ();";
+    c_fix_arg = "^static int[ \t]+size;";
+    test_text = "static int size;\n"
+                "/* stuff which calls getrnge() */\n"
+                "static getrnge()\n"
+                "{}";
+};
+
+
+/*
  *  Like svr4_mach_defines, but with newfangled syntax.
  *  Source lines are of #define __i386 #machine(i386).   Delete them.
  */
@@ -3280,6 +3481,8 @@ 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;
@@ -3287,10 +3490,11 @@ fix = {
     bypass    = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
 
     c_fix     = format;
-    c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
-    c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
+    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";
+    test_text = "#define NULL 0UL\r\n"
+                "#define NULL\t((void*)0)\n";
 };
 
 /*
@@ -3362,7 +3566,7 @@ fix = {
 
 
 /*
- *  AIX headers define NULL to be cast to a void pointer,
+ *  AIX and Interix headers define NULL to be cast to a void pointer,
  *  which is illegal in ANSI C++.
  */
 fix = {