OSDN Git Service

* fixinc/fixtests.c(stdc_0_in_system_headers_test): Must return "FIX"
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / inclhack.def
index c5f9bdc..03b99cf 100644 (file)
@@ -60,6 +60,18 @@ fix = {
 
 
 /*
+ * Tru64 UNIX V4.0F/V5.1 <standards.h> defines _NO_PROTO and _NONSTD_TYPES
+ * correctly for GCC, but strict_ansi_not breaks it.
+ */
+fix = {
+    hackname = AAA_standards;
+    files    = standards.h;
+    select   = 'GNU and MIPS C compilers define __STDC__ differently';
+    replace; /* empty replacement -> no fixing the file */
+};
+
+
+/*
  *  This file on SunOS 4 has a very large macro.  When the sed loop
  *  tries pull it in, it overflows the pattern space size of the SunOS
  *  sed (GNU sed does not have this problem).  Since the file does not
@@ -86,13 +98,14 @@ fix = {
 /* And now, the real fixes, replacement text fixes first: */
 
 /*
- *  Completely replace &lt;_int_varargs.h&gt; with a file that includes gcc's
+ *  Completely replace <_int_varargs.h> with a file that includes gcc's
  *  stdarg.h or varargs.h files as appropriate on DG/UX
  */
 fix = {
     hackname = AAB_dgux_int_varargs;
     files    = _int_varargs.h;
-    replace  = "#ifndef __INT_VARARGS_H
+    replace  =
+"#ifndef __INT_VARARGS_H
 \#define __INT_VARARGS_H
 
 /************************************************************************/
@@ -105,7 +118,7 @@ fix = {
 */
 
 \#ifndef ___int_features_h
-\#include &lt;sys/_int_features.h&gt;
+\#include <sys/_int_features.h>
 \#endif
 
 \#if !(defined(_VA_LIST) || defined(_VA_LIST_))
@@ -525,9 +538,7 @@ fix = {
     files    = limits.h;
     mach     = "*-*-ultrix4.3";
     replace  =
-'/*    @(#)limits.h                            */
-/* This file was generated by fixincludes      */
-\#ifndef _LIMITS_INCLUDED
+'#ifndef _LIMITS_INCLUDED
 \#define _LIMITS_INCLUDED
 \#include <sys/limits.h>
 \#endif /* _LIMITS_INCLUDED */
@@ -545,9 +556,7 @@ fix = {
     files    = memory.h;
     mach     = "*-*-ultrix4.3";
     replace  =
-'/*    @(#)memory.h                            */
-/* This file was generated by fixincludes      */
-\#ifndef _MEMORY_INCLUDED
+'#ifndef _MEMORY_INCLUDED
 \#define _MEMORY_INCLUDED
 \#include <strings.h>
 \#endif /* _MEMORY_INCLUDED */
@@ -565,9 +574,7 @@ fix = {
     files    = string.h;
     mach     = "*-*-ultrix4.3";
     replace  =
-'/*    @(#)string.h                            */
-/* This file was generated by fixincludes      */
-\#ifndef _STRING_INCLUDED
+'#ifndef _STRING_INCLUDED
 \#define _STRING_INCLUDED
 \#include <strings.h>
 \#endif /* _STRING_INCLUDED */
@@ -639,6 +646,19 @@ fix = {
 
 
 /*
+ *  Fix __assert declaration in assert.h on Alpha OSF/1.
+ */
+fix = {
+    hackname  = alpha___assert;
+    files     = "assert.h";
+    select    = '__assert\(char \*, char \*, int\)';
+    c_fix     = format;
+    c_fix_arg = "__assert(const char *, const char *, int)";
+    test_text = 'extern void __assert(char *, char *, int);';
+};
+
+
+/*
  *  Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
  */
 fix = {
@@ -764,11 +784,25 @@ fix = {
 
     c_fix     = format;
     c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
-    c_fix_arg = "^[ \t]*typedef[ \t].*[ \t]bool[ \t]*;.*";
 
-    test_text = "typedef unsigned int\tbool \t; /* bool type */";
+    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.
+ */
+
+fix = {
+    hackname = avoid_wchar_t_type;
+
+    select    = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
+
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+
+    test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
+};
 
 /*
  *  Fix #defines under Alpha OSF/1:
@@ -876,7 +910,7 @@ fix = {
 
 /*
  *  Remove `extern double cabs' declarations from math.h.
- *  This conflicts with C9x.  Discovered on AIX.
+ *  This conflicts with C99.  Discovered on AIX.
  *  SunOS4 has its cabs() declaration followed by a comment which
  *  terminates on the following line.
  */
@@ -986,6 +1020,21 @@ fix = {
 
 
 /*
+ * Fix typo in <wchar.h> on DJGPP 2.03.
+ */
+fix = {
+    hackname  = djgpp_wchar_h;
+    file      = wchar.h;
+    select    = "__DJ_wint_t";
+    bypass    = "sys/djtypes.h";
+    c_fix     = format;
+    c_fix_arg = "%0\n#include <sys/djtypes.h>";
+    c_fix_arg = "#include <stddef.h>";
+    test_text = "#include <stddef.h>\n"
+                "extern __DJ_wint_t x;\n";
+};
+
+/*
  * Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
  */
 fix = {
@@ -1017,6 +1066,23 @@ fix = {
 
 
 /*
+ *  Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
+ *  neither the existence of GCC 3 nor its exact feature set yet break
+ *  (by design?) when __GNUC__ is set beyond 2.
+ */
+fix = {
+    hackname  = freebsd_gcc3_breakage;
+    mach      = *-*-freebsd*;
+    files     = sys/cdefs.h;
+    select    = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
+    bypass    = '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
+    c_fix     = format;
+    c_fix_arg = '%0 || __GNUC__ >= 3';
+    test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
+};
+
+
+/*
  *  Fix HP & Sony's use of "../machine/xxx.h"
  *  to refer to:  <machine/xxx.h>
  */
@@ -1206,11 +1272,15 @@ fix = {
 fix = {
     hackname  = hpux_maxint;
     files     = sys/param.h;
-    select    = "^#[ \t]*define[ \t]*MAXINT[ \t]";
+    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].*";
+    c_fix_arg = "^#[ \t]*define[ \t]+MAXINT[ \t].*";
 
     test_text = '#define MAXINT 0x7FFFFFFF';
 };
@@ -1266,6 +1336,35 @@ fix = {
 
 
 /*
+ *  IRIX 5.x's stdio.h declares 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;
+
+    select = '(printf\(.*), /\* va_list \*/ char \*';
+    c_fix  = format;
+    c_fix_arg = "%1, __gnuc_va_list";
+    test_text =
+    "extern int printf( const char *, /* va_list */ char * );";
+};
+
+
+/*
+ *  Non-traditional "const" declaration in Irix's limits.h.
+ */
+fix = {
+    hackname   = irix_limits_const;
+    files      = fixinc-test-limits.h, limits.h;
+    select     = "^extern const ";
+    c_fix      = format;
+    c_fix_arg  = "extern __const ";
+    test_text   = "extern const char limit; /* test limits */";
+};
+
+
+/*
  * Fixing ISC fmod declaration
  */
 fix = {
@@ -1457,10 +1556,12 @@ fix = {
 
 /*
  * Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
+ * 
+ * On NetBSD, machine is a symbolic link to an architecture specific
+ * directory name, so we can't match a specific file name here.
  */
 fix = {
     hackname = machine_ansi_h_va_list;
-    files    = machine/ansi.h;
     select   = "define[ \t]+_BSD_VA_LIST_[ \t]";
     bypass   = '__builtin_va_list';
 
@@ -1871,18 +1972,67 @@ fix = {
 
 
 /*
- *  "!__STDC__" is "!defined( __STRICT_ANSI__ )"
+ *  "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
+ *  is "!defined( __STRICT_ANSI__ )"
  */
 fix = {
-    hackname = sco_strict_ansi;
-    mach     = "i?86-*-sco3.2*";
-    select   = "^[ \t]*#[ \t]*if.*!__STDC__";
+    hackname = strict_ansi_not;
+    select   = "^([ \t]*#[ \t]*if.*)"
+               "(!__STDC__"
+               "|__STDC__[ \t]*==[ \t]*0"
+               "|__STDC__[ \t]*!=[ \t]*1"
+               "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0"
+               ")(.*)";
+    c_test   = stdc_0_in_system_headers;
+
+    c_fix     = format;
+    c_fix_arg = "%1 !defined(__STRICT_ANSI__)%3";
+
+    test_text = "#if !__STDC__ \n"
+                "#if __STDC__ == 0\n"
+                "#if __STDC__ != 1\n"
+                "#if __STDC__ - 0 == 0"
+               "/* not std C */\nint foo;\n"
+               "\n#end-end-end-end-if :-)";
+};
+
+/*
+ *  "__STDC__-0==0"
+ *  is "!defined( __STRICT_ANSI__ )" on continued #if-s
+ */
+fix = {
+    hackname = strict_ansi_not_ctd;
+    files    = math.h, limits.h, stdio.h, signal.h, stdlib.h, time.h;
+    select   = "^([ \t]*[|&][|&][ \t(]*)"
+               "(__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0"
+               ")(.*)";
+    c_test   = stdc_0_in_system_headers;
 
     c_fix     = format;
-    c_fix_arg = "%1defined(__STRICT_ANSI__)%2";
-    c_fix_arg = "^([ \t]*#[ \t]*if[ \t].*!)__STDC__(.*)";
+    c_fix_arg = "%1 !defined(__STRICT_ANSI__)%3";
 
-    test_text = "#if !__STDC__ /* not standard C */\nint foo;\n#endif";
+    test_text = "#if 1\\\n"
+               "|| __STDC__ - 0 == 0 /* not std C */\nint foo;\n#endif";
+};
+
+/*
+ *  "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
+ *  is "defined( __STRICT_ANSI__ )"
+ */
+fix = {
+    hackname = strict_ansi_only;
+    select   = "^([ \t]*#[ \t]*if.*)"
+               "(__STDC__[ \t]*!=[ \t]*0"
+               "|__STDC__[ \t]*==[ \t]*1"
+               "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*1"
+               "|__STDC__[ \t]*-[ \t]*0[ \t]*!=[ \t]*0"
+               ")(.*)";
+    c_test   = stdc_0_in_system_headers;
+
+    c_fix     = format;
+    c_fix_arg = "%1 defined(__STRICT_ANSI__)%3";
+
+    test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
 };
 
 
@@ -1904,6 +2054,26 @@ fix = {
 
 
 /*
+ * Sun Solaris 2.7 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
+ * __STDC__ defined (e.g. by -ansi) it is a union. So change the
+ * initializer to "{0}" instead
+ */
+fix = {
+  hackname = solaris27_mutex_init;
+  select = '@\(#\)pthread.h' "[ \t]+1.26[ \t]+98/04/12 SMI";
+  files = pthread.h;
+  c_fix = format;
+  c_fix_arg = "%1, {0}}";
+  c_fix_arg = "(define[ \t]+PTHREAD_MUTEX_INITIALIZER.*),[ \t]*0}$";
+  test_text =
+  '#ident "@(#)pthread.h  1.26  98/04/12 SMI"'"\n"
+  "#define PTHREAD_MUTEX_INITIALIZER {{{0},0}, {{{0}}}, 0}";
+};
+
+
+/*
  *  Sony NEWSOS 5.0 does not support the complete ANSI C standard.
  */
 #ifdef SONY
@@ -1991,7 +2161,7 @@ fix = {
 fix = {
     hackname = stdio_va_list;
     files    = stdio.h;
-    bypass   = '__gnuc_va_list|_BSD_VA_LIST_';
+    bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list';
 
     /*
      * Use __gnuc_va_list in arg types in place of va_list.
@@ -2018,21 +2188,6 @@ fix = {
 
 
 /*
- *  Check for strict ansi compliance
- */
-#ifdef STRICT_ANSI
-fix = {
-    hackname = strict_ansi;
-    select   = "__STDC__[ \t]*[=!]=[ \t]*[01]";
-    sed      = "s/__STDC__[ \t]*==[ \t]*0/!defined (__STRICT_ANSI__)/g";
-    sed      = "s/__STDC__[ \t]*!=[ \t]*0/defined (__STRICT_ANSI__)/g";
-    sed      = "s/__STDC__[ \t]*==[ \t]*1/defined (__STRICT_ANSI__)/g";
-    sed      = "s/__STDC__[ \t]*!=[ \t]*1/!defined (__STRICT_ANSI__)/g";
-};
-#endif
-
-
-/*
  *  IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
  *  in prototype without previous definition.
  */
@@ -2186,7 +2341,7 @@ fix = {
     files     = math.h;
 
     /*  If matherr has a prototype already, the header needs no fix.  */
-    bypass    = 'matherr.*struct exception';
+    bypass    = 'matherr.*(struct exception|__MATH_EXCEPTION)';
     select    = matherr;
 
     c_fix     = wrap;