OSDN Git Service

snprintf alphabetically precedes uint
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / inclhack.def
index 34e4b87..432d016 100644 (file)
@@ -235,7 +235,6 @@ fix = {
     mach     = "powerpcle-*-solaris2.[0-4]";
     mach     = "sparc-*-solaris2.[0-4]";
     mach     = "i[34567]86-sequent-ptx*";
-    mach     = "i[34567]86-sequent-sysv3*";
     files    = sys/byteorder.h;
     replace  = <<-  _EndOfHeader_
        #ifndef _SYS_BYTEORDER_H
@@ -600,6 +599,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
  *  And OpenBSD.
  */
@@ -1191,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
@@ -1481,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 * );";
 };
@@ -1653,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 = {
@@ -1943,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.
@@ -2002,30 +2081,6 @@ fix = {
 
 
 /*
- * In pwd.h, PTX 1.x needs stdio.h included since FILE * was added in a
- * prototype later on in the file.  (It's not clear that this is
- * still true, and even if it is, FILE * may be added after this fix runs by
- * fixproto.)
- */
-#ifdef PTX
-fix = {
-    hackname  = ptx_pwd_h;
-    files     = pwd.h;
-    select    = 'FILE \*';
-    bypass    = 'stdio.h';
-    sed       = "/#include <sys\\/types\\.h/a\\\n"
-                "\\\n"
-                "#if defined(__STDC__) || defined(__cplusplus)\\\n"
-                "#include <stdio.h>\\\n"
-                "#endif  /*  __STDC__ */\\\n"
-                "\n";
-    test_text = "#include <sys/types.h>\n"
-                "void foo (FILE *)";
-};
-#endif
-
-
-/*
  * 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.
@@ -2346,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;
@@ -2415,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"
@@ -2854,7 +2909,6 @@ fix = {
      * in any case. -- Nathanael */
     mach     = '*-*-sysv4*';
     mach     = 'i?86-sequent-ptx*';
-    mach     = 'i?86-sequent-sysv3*';
     files    = fs/rfs/rf_cache.h;
     files    = sys/erec.h;
     files    = sys/err.h;
@@ -3427,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;
@@ -3434,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";
 };
 
 /*