arc: Refurbish adc/sbc patterns
[gcc.git] / fixincludes / inclhack.def
index 3c6b48d26e12189e1cd990ff190e20f352eba2c5..80c9adfb07c5911fac60ddf8b972411a0fc27db7 100644 (file)
@@ -553,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)";
 };
 
 /*
@@ -580,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);";
 };
 
 /*
@@ -697,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.
@@ -2587,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
  */