arc: Refurbish adc/sbc patterns
[gcc.git] / fixincludes / inclhack.def
index 727f7d2cb2887d35ecb4a0f7219ac04f7fff5787..80c9adfb07c5911fac60ddf8b972411a0fc27db7 100644 (file)
@@ -194,6 +194,33 @@ fix = {
        _EndOfHeader_;
 };
 
+/*
+ *  SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where
+ *  __attribute__((availability)) is not supported.
+ */
+fix = {
+    hackname  = darwin_api_availability;
+    mach      = "*-*-darwin*";
+    files     = os/availability.h;
+    bypass    = "__IPHONE_OS_VERSION_MIN_REQUIRED";
+    select    =
+    " *#define __API_AVAILABLE.*\n"
+    " *#define __API_DEPRECATED.*\n"
+    " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n"
+    " *#define __API_UNAVAILABLE.*\n";
+    c_fix     = format;
+    c_fix_arg =
+    "    #define API_AVAILABLE(...)\n"
+    "    #define API_DEPRECATED(...)\n"
+    "    #define API_DEPRECATED_WITH_REPLACEMENT(...)\n"
+    "    #define API_UNAVAILABLE(...)\n";
+    test_text =
+    "#define __API_AVAILABLE(...)\n"
+    "#define __API_DEPRECATED(...)\n"
+    "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n"
+    "#define __API_UNAVAILABLE(...)\n";
+};
+
 /*
  *  This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
  */
@@ -526,24 +553,41 @@ fix = {
   hackname  = aix_externcpp1;
   mach      = "*-*-aix*";
   files     = "sys/socket.h";
-  select    = "#ifdef __cplusplus";
+  select    = "#ifndef _KERNEL\n"
+             "#ifdef __cplusplus";
   c_fix     = format;
-  c_fix_arg = "#ifdef __cplusplus\n"
+  c_fix_arg = "#ifndef _KERNEL\n"
+             "#ifdef __cplusplus\n"
               "extern \"C++\" {";
-  test_text = "#ifdef __cplusplus";
-
+  test_text = "#ifndef _KERNEL\n"
+             "#ifdef __cplusplus";
 };
 
 fix = {
   hackname  = aix_externcpp2;
   mach      = "*-*-aix*";
   files     = "sys/socket.h";
-  select    = "#else  /\\* __cplusplus \\*/";
+  select    = "#endif /\\* COMPAT_43 \\*/\n"
+             "#else  /\\* __cplusplus \\*/";
   c_fix     = format;
-  c_fix_arg = "} /* extern \"C++\" */\n"
+  c_fix_arg = "#endif /* COMPAT_43 */\n"
+             "} /* extern \"C++\" */\n"
               "#else  /* __cplusplus */";
-  test_text = "#else  /* __cplusplus */";
+  test_text = "#endif /* COMPAT_43 */\n"
+             "#else  /* __cplusplus */";
+};
 
+/*
+ *  inttypes.h STDC_FORMAT_MACROS
+ */
+fix = {
+    hackname  = aix_inttypes;
+    mach      = "*-*-aix*";
+    files     = "sys/inttypes.h";
+    select    = "#if !defined\\(__cplusplus\\) \\|\\| defined\\(__STDC_FORMAT_MACROS\\)";
+    c_fix     = format;
+    c_fix_arg = "#if 1";
+    test_text = "#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)";
 };
 
 /*
@@ -553,10 +597,16 @@ fix = {
     hackname  = aix_malloc;
     mach      = "*-*-aix*";
     files     = "malloc.h";
-    select    = "#ifdef __cplusplus";
+    select    = "#ifdef __cplusplus\n"
+                "extern \"C\" \\{\n"
+                "[ \t]extern \"builtin\" char \\*__alloca \\(size_t\\);";
     c_fix     = format;
-    c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
-    test_text = "#ifdef __cplusplus";
+    c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
+                "extern \"C\" {\n"
+       "\textern \"builtin\" char *__alloca (size_t);";
+    test_text = "#ifdef __cplusplus\n"
+                "extern \"C\" {\n"
+       "\textern \"builtin\" char *__alloca (size_t);";
 };
 
 /*
@@ -670,6 +720,20 @@ fix = {
                "{ \\\\\n";
 };
 
+
+/* On AIX 'typedef struct {<stuff>} * physadr_t;' needs to give the struct a
+   name for linkage purposes.  Fortunately it is on exactly one
+   line.  */
+fix = {
+    hackname  = aix_physadr_t;
+    mach      = "*-*-aix*";
+    files     = sys/types.h;
+    select    = "typedef[ \t]*struct[ \t]*([{][^}]*[}][ \t]*\\*[ \t]*physadr_t;)";
+    c_fix     = format;
+    c_fix_arg = "typedef struct __physadr_s %1";
+    test_text = "typedef struct __physadr_s {";
+};
+
 /*
  *  pthread.h on AIX 4.3.3 tries to define a macro without whitspace
  *  which violates a requirement of ISO C.
@@ -1298,12 +1362,12 @@ fix = {
 };
 
 /*
- *  For the AAB_darwin7_9_long_double_funcs fix to be useful,
- *  you have to not use "" includes.
+ *  For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long)
+ *  to be useful, the main math.h must use <> and not "" includes.
  */
 fix = {
     hackname  = darwin_9_long_double_funcs_2;
-    mach      = "*-*-darwin7.9*";
+    mach      = "*-*-darwin*";
     files     = math.h;
     select    = '#include[ \t]+\"';
     c_fix     = format;
@@ -1311,7 +1375,7 @@ fix = {
   
     c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
   
-    test_text = '#include "architecture/ppc/math.h"';
+    test_text = '#include <architecture/ppc/math.h>';
 };
 
 /*
@@ -1354,6 +1418,22 @@ fix = {
              "(__GNUC_MINOR__ >= 1)\n";
 };
 
+/*
+ * math.h hides the long long functions that are available on the system for
+ * 10.5 and 10.6 SDKs, we expect to use them in G++ without specifying a value
+ * for __STDC_VERSION__, or switching __STRICT_ANSI__ off.
+ */
+fix = {
+  hackname  = darwin_ll_funcs_avail;
+  mach      = "*-*-darwin*";
+  files     = architecture/ppc/math.h, architecture/i386/math.h;
+  select    = "#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^1]*199901L[^_]*"
+             "__STRICT_ANSI__[^_]*__GNUC__[^\)]*";
+  sed       = "s/#if[^_]*__STDC_VERSION__[^_]*__STDC_VERSION__[^_]*199901L[^_]*"
+             "__STRICT_ANSI__[^_]*__GNUC__[^\\)]*\)/#if\ !\(__DARWIN_NO_LONG_LONG\)/";
+  test_text = "#if\ !(__DARWIN_NO_LONG_LONG)";
+};
+
 /*
  *  Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn.
  */
@@ -2544,6 +2624,47 @@ fix = {
                "#  define      UINT16_C(__c)   ((unsigned short)(__c))\n";
 };
 
+/*
+ * Fix broken and missing defines in inttypes.h
+ */
+fix = {
+    hackname  = hpux_c99_inttypes3;
+    mach      = "hppa*-hp-hpux11*";
+    files     = inttypes.h;
+    select    = "#define[ \t]INTPTR_MAX[ \t]*\n"
+               "#define[ \t]UINTPTR_MAX[ \t]*\n";
+    c_fix     = format;
+    c_fix_arg = "#undef SIZE_MAX\n"
+               "#define SIZE_MAX __SIZE_MAX__\n"
+               "#ifdef __INTPTR_MAX__\n"
+               "# undef INTPTR_MAX\n"
+               "# define INTPTR_MAX __INTPTR_MAX__\n"
+               "# undef INTPTR_MIN\n"
+               "# define INTPTR_MIN (-INTPTR_MAX - 1)\n"
+               "#endif\n"
+               "#ifdef __UINTPTR_MAX__\n"
+               "# undef UINTPTR_MAX\n"
+               "# define UINTPTR_MAX __UINTPTR_MAX__\n"
+               "#endif\n";
+    test_text = "#define INTPTR_MAX\n"
+               "#define UINTPTR_MAX\n";
+};
+
+/*
+ * Fix missing SCNuMAX defines in inttypes.h
+ */
+fix = {
+    hackname  = hpux_c99_inttypes4;
+    mach      = "hppa*-hp-hpux11.[01]*";
+    files     = inttypes.h;
+    sed       = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx64/a\\\n"
+               "#define SCNuMAX \t SCNu64\n";
+    sed       = "/^[ \t]*#[ \t]*define[ \t]*SCNxMAX[ \t]*SCNx32/a\\\n"
+               "#define SCNuMAX \t SCNu32\n";
+    test_text = "#define SCNxMAX SCNx64\n"
+               "#define SCNxMAX SCNx32\n";
+};
+
 /*
  *  Fix hpux broken ctype macros
  */