OSDN Git Service

* calls.c (expand_call): Handle current_function_pretend_args_size
[pf3gnuchains/gcc-fork.git] / fixincludes / inclhack.def
index 38021c3..f55a9f0 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?
  */
@@ -1116,6 +1177,9 @@ fix = {
     bypass    = '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
     select    = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
     c_fix     = gnu_type;
+    /* The Solaris 10 headers already define these types correctly.  */
+    mach   = '*-*-solaris2.1[0-9]*';
+    not_machine = true;
 
     test_text = "typedef long int ptrdiff_t; /* long int */\n"
                 "typedef uint_t size_t; /* uint_t */\n"
@@ -1415,6 +1479,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]*) {.*}@@";
@@ -1442,6 +1507,34 @@ fix = {
 
 
 /*
+ *  Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
+ */
+fix = {
+    hackname = hpux_htonl;
+    files    = netinet/in.h;
+    select   = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
+               "(/\\*\n"
+               " \\* Macros for number representation conversion\\.\n"
+               " \\*/\n"
+               "#ifndef ntohl)";
+    c_fix     = format;
+    c_fix_arg = "#if 1\n%1";
+
+    test_text = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
+                "/*\n"
+                " * Macros for number representation conversion.\n"
+                " */\n"
+                "#ifndef ntohl\n"
+                "#define ntohl(x)        (x)\n"
+                "#define ntohs(x)        (x)\n"
+                "#define htonl(x)        (x)\n"
+                "#define htons(x)        (x)\n"
+                "#endif\n"
+                "#endif  /* ! _XOPEN_SOURCE_EXTENDED */";
+};
+
+
+/*
  * HP-UX long_double
  */
 fix = {
@@ -1463,26 +1556,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 = {
@@ -1504,6 +1577,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(";
@@ -1844,34 +1918,6 @@ 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.
- */
-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' */";
-};
-
-
 /* 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++.
@@ -2041,23 +2087,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 = {
@@ -2286,6 +2315,19 @@ fix = {
     test_text = "int __page_size;";
 };
 
+/*
+ * On broken glibc-2.3.3 systems an array of incomplete structures is
+ * passed to __sigsetjmp.  Fix that to take a pointer instead.
+ */
+fix = {
+    hackname  = pthread_incomplete_struct_argument;
+    files     = pthread.h;
+    select    = "struct __jmp_buf_tag";
+    c_fix     = format;
+    c_fix_arg = "%1 *%2%3";
+    c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
+    test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
+};
 
 /*
  * On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
@@ -2412,6 +2454,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      =
@@ -2600,6 +2643,9 @@ fix = {
     files    = stdio_tag.h;
 
     select   = '__cplusplus < 54321L';
+    /* In Solaris 10, the code in stdio_tag.h is conditionalized on 
+       "!defined(__GNUC__)" so we no longer need to fix it.  */
+    bypass   = '__GNUC__';
     sed      = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
 
     test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
@@ -2665,6 +2711,12 @@ fix = {
     hackname = stdio_stdarg_h;
     files    = stdio.h;
     bypass   = "include.*(stdarg\.h|machine/ansi\.h)";
+    /*
+     * On Solaris 10, this fix is unncessary; <stdio.h> includes
+     * <iso/stdio_iso.h>, which includes <sys/va_list.h>.
+      */
+    mach     = '*-*-solaris2.1[0-9]';
+    not_machine = true;
 
     c_fix     = wrap;
 
@@ -2675,21 +2727,66 @@ 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';
+    /* 
+     * On Solaris 10, the definition in 
+     * <stdio.h> is guarded appropriately by the _XPG4 feature macro; 
+     * there is therefore no need for this fix there.
+     */
+    mach = '*-*-solaris2.1[0-9]';
+    not_machine = true;
+
+    /*
+     * 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;
@@ -2699,6 +2796,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.
@@ -2854,6 +2954,7 @@ fix = {
     files    = rpc/clnt.h;
     files    = rpc/svc.h;
     files    = rpc/xdr.h;
+    bypass   = "__cplusplus";
     /*
      *  Select those files containing '(*name)()'.
      */
@@ -2912,6 +3013,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";
@@ -2974,23 +3076,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.
@@ -3415,6 +3500,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);/";
@@ -3456,6 +3542,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;
@@ -3843,25 +3930,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.
  */
@@ -3946,6 +4014,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";