OSDN Git Service

snprintf alphabetically precedes uint
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / inclhack.def
index edf28b5..432d016 100644 (file)
@@ -599,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.
  */
@@ -1190,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
@@ -1480,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 * );";
 };
@@ -1957,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.
@@ -2336,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;
@@ -2405,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"