* inclhack.def (glibc_c99_inline_1): New.
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Nov 2006 03:11:50 +0000 (03:11 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Nov 2006 03:11:50 +0000 (03:11 +0000)
* inclhack.def (glibc_c99_inline_2): New.
* inclhack.def (glibc_c99_inline_3): New.
* inclhack.def (glibc_c99_inline_4): New.
* fixincl.x: Regenerate.
* tests/base/bits/string2.h: New.
* tests/base/sys/sysmacros.h: New.
* tests/base/sys/stat.h: Update.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118449 138bc75d-0d04-0410-961f-82ee72b054a4

fixincludes/ChangeLog
fixincludes/fixincl.x
fixincludes/inclhack.def
fixincludes/tests/base/bits/string2.h [new file with mode: 0644]
fixincludes/tests/base/sys/stat.h
fixincludes/tests/base/sys/sysmacros.h [new file with mode: 0644]

index 89e8c5e..b244560 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-02  Geoffrey Keating  <geoffk@apple.com>
+
+       * inclhack.def (glibc_c99_inline_1): New.
+       * inclhack.def (glibc_c99_inline_2): New.
+       * inclhack.def (glibc_c99_inline_3): New.
+       * inclhack.def (glibc_c99_inline_4): New.
+       * fixincl.x: Regenerate.
+       * tests/base/bits/string2.h: New.
+       * tests/base/sys/sysmacros.h: New.
+       * tests/base/sys/stat.h: Update.
+
 2006-11-01  Steve Ellcey  <sje@cup.hp.com>
 
        * tests/base/sys/socket.h: Update.
index e5994a2..4ace83f 100644 (file)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Tuesday October 31, 2006 at 08:47:53 AM PST
+ * It has been AutoGen-ed  Friday November  3, 2006 at 03:53:48 AM CET
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Tue Oct 31 08:47:53 PST 2006
+/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Nov  3 03:53:48 CET 2006
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 203 fixup descriptions.
+ * This file contains 207 fixup descriptions.
  *
  * See README for more information.
  *
@@ -26,8 +26,7 @@
  *  
  *  You may redistribute it and/or modify it under the terms of the
  *  GNU General Public License, as published by the Free Software
- *  Foundation; either version 2 of the License, or (at your option)
- *  any later version.
+ *  Foundation; either version 2, or (at your option) any later version.
  *  
  *  inclhack is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  See the GNU General Public License for more details.
  *  
  *  You should have received a copy of the GNU General Public License
- *  along with inclhack.  If not, write to:
- *     The Free Software Foundation, Inc.,
- *     51 Franklin Street, Fifth Floor
- *     Boston, MA  02110-1301, USA.
+ *  along with inclhack.  See the file "COPYING".  If not,
+ *  write to:  The Free Software Foundation, Inc.,
+ *             59 Temple Place - Suite 330,
+ *             Boston,  MA  02111-1307, USA.
  */
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -2186,6 +2185,162 @@ static const char* apzFreebsd_Gcc4_BreakagePatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Glibc_C99_Inline_1 fix
+ */
+tSCC zGlibc_C99_Inline_1Name[] =
+     "glibc_c99_inline_1";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_C99_Inline_1List[] =
+  "|features.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_C99_Inline_1Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_C99_Inline_1Select0[] =
+       "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
+
+#define    GLIBC_C99_INLINE_1_TEST_CT  1
+static tTestDesc aGlibc_C99_Inline_1Tests[] = {
+  { TT_EGREP,    zGlibc_C99_Inline_1Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_C99_Inline_1
+ */
+static const char* apzGlibc_C99_Inline_1Patch[] = {
+    "format",
+    "%0 && __STDC_VERSION__ < 199901L",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_C99_Inline_2 fix
+ */
+tSCC zGlibc_C99_Inline_2Name[] =
+     "glibc_c99_inline_2";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_C99_Inline_2List[] =
+  "|sys/stat.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_C99_Inline_2Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_C99_Inline_2Select0[] =
+       "extern __inline__ int";
+
+#define    GLIBC_C99_INLINE_2_TEST_CT  1
+static tTestDesc aGlibc_C99_Inline_2Tests[] = {
+  { TT_EGREP,    zGlibc_C99_Inline_2Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_C99_Inline_2
+ */
+static const char* apzGlibc_C99_Inline_2Patch[] = { "sed",
+    "-e", "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/#if __STDC_VERSION__ < 199901L\\\n\
+extern\\\n\
+#endif\\\n\
+__inline__ int \\1/",
+    "-e", "s/extern int __REDIRECT_NTH (\\(stat\\|lstat\\|fstat\\)/#if __STDC_VERSION__ < 199901L\\\n\
+extern\\\n\
+#endif\\\n\
+__inline__ int __REDIRECT_NTH (\\1/",
+    "-e", "/^extern __inline__ int$/ c\\\n\
+#if __STDC_VERSION__ < 199901L\\\n\
+extern\\\n\
+#endif\\\n\
+__inline__ int\n",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_C99_Inline_3 fix
+ */
+tSCC zGlibc_C99_Inline_3Name[] =
+     "glibc_c99_inline_3";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_C99_Inline_3List[] =
+  "|bits/string2.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_C99_Inline_3Machs (const char**)NULL
+
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zGlibc_C99_Inline_3Bypass0[] =
+       "__STDC_VERSION__";
+
+#define    GLIBC_C99_INLINE_3_TEST_CT  1
+static tTestDesc aGlibc_C99_Inline_3Tests[] = {
+  { TT_NEGREP,   zGlibc_C99_Inline_3Bypass0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_C99_Inline_3
+ */
+static const char* apzGlibc_C99_Inline_3Patch[] = {
+    "format",
+    "# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L",
+    "^# ifdef __cplusplus$",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Glibc_C99_Inline_4 fix
+ */
+tSCC zGlibc_C99_Inline_4Name[] =
+     "glibc_c99_inline_4";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_C99_Inline_4List[] =
+  "|sys/sysmacros.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_C99_Inline_4Machs (const char**)NULL
+
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zGlibc_C99_Inline_4Bypass0[] =
+       "__STDC_VERSION__";
+
+#define    GLIBC_C99_INLINE_4_TEST_CT  1
+static tTestDesc aGlibc_C99_Inline_4Tests[] = {
+  { TT_NEGREP,   zGlibc_C99_Inline_4Bypass0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_C99_Inline_4
+ */
+static const char* apzGlibc_C99_Inline_4Patch[] = {
+    "format",
+    "\n\
+#if __STDC_VERSION__ < 19901L\n\
+extern\n\
+#endif\n",
+    "extern",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Glibc_Mutex_Init fix
  */
 tSCC zGlibc_Mutex_InitName[] =
@@ -8265,9 +8420,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          246
+#define REGEX_COUNT          250
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            203
+#define FIX_COUNT            207
 
 /*
  *  Enumerate the fixes
@@ -8323,6 +8478,10 @@ typedef enum {
     EXCEPTION_STRUCTURE_FIXIDX,
     FREEBSD_GCC3_BREAKAGE_FIXIDX,
     FREEBSD_GCC4_BREAKAGE_FIXIDX,
+    GLIBC_C99_INLINE_1_FIXIDX,
+    GLIBC_C99_INLINE_2_FIXIDX,
+    GLIBC_C99_INLINE_3_FIXIDX,
+    GLIBC_C99_INLINE_4_FIXIDX,
     GLIBC_MUTEX_INIT_FIXIDX,
     GNU_TYPES_FIXIDX,
     HP_INLINE_FIXIDX,
@@ -8729,6 +8888,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      FREEBSD_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aFreebsd_Gcc4_BreakageTests,   apzFreebsd_Gcc4_BreakagePatch, 0 },
 
+  {  zGlibc_C99_Inline_1Name,    zGlibc_C99_Inline_1List,
+     apzGlibc_C99_Inline_1Machs,
+     GLIBC_C99_INLINE_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_C99_Inline_1Tests,   apzGlibc_C99_Inline_1Patch, 0 },
+
+  {  zGlibc_C99_Inline_2Name,    zGlibc_C99_Inline_2List,
+     apzGlibc_C99_Inline_2Machs,
+     GLIBC_C99_INLINE_2_TEST_CT, FD_MACH_ONLY,
+     aGlibc_C99_Inline_2Tests,   apzGlibc_C99_Inline_2Patch, 0 },
+
+  {  zGlibc_C99_Inline_3Name,    zGlibc_C99_Inline_3List,
+     apzGlibc_C99_Inline_3Machs,
+     GLIBC_C99_INLINE_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_C99_Inline_3Tests,   apzGlibc_C99_Inline_3Patch, 0 },
+
+  {  zGlibc_C99_Inline_4Name,    zGlibc_C99_Inline_4List,
+     apzGlibc_C99_Inline_4Machs,
+     GLIBC_C99_INLINE_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_C99_Inline_4Tests,   apzGlibc_C99_Inline_4Patch, 0 },
+
   {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
      apzGlibc_Mutex_InitMachs,
      GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
index becae87..bf3517a 100644 (file)
@@ -1289,6 +1289,81 @@ fix = {
 };
 
 
+/*
+ *  Some versions of glibc don't expect the C99 inline semantics.
+ */
+fix = {
+    hackname  = glibc_c99_inline_1;
+    files     = features.h;
+    select    = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
+    c_fix     = format;
+    c_fix_arg = "%0 && __STDC_VERSION__ < 199901L";
+    test_text = <<-EOT
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+# define __USE_EXTERN_INLINES  1
+#endif
+EOT;
+};
+
+
+/*
+ * The glibc_c99_inline_1 fix should have fixed everything.  Unfortunately
+ * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
+ * The remaining glibc_c99_inline_* fixes deal with some of those headers.
+ */
+fix = {
+    hackname  = glibc_c99_inline_2;
+    files     = sys/stat.h;
+    select    = "extern __inline__ int";
+    sed              = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
+               "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n"
+               "__inline__ int \\1/";
+    sed              = "s/extern int __REDIRECT_NTH (\\(stat\\|lstat\\|fstat\\)/"
+               "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n"
+               "__inline__ int __REDIRECT_NTH (\\1/";
+    sed              = "/^extern __inline__ int$/ c\\\n"
+               "#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n"
+               "__inline__ int\n";
+    test_text = <<-EOT
+extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+extern __inline__ int
+__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
+{}
+EOT;
+};
+
+
+fix = {
+    hackname  = glibc_c99_inline_3;
+    files     = bits/string2.h;
+    bypass    = "__STDC_VERSION__";
+    c_fix     = format;
+    c_fix_arg = "# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L";
+    c_fix_arg = "^# ifdef __cplusplus$";
+    test_text = <<-EOT
+# ifdef __cplusplus
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
+EOT;
+};
+
+
+fix = {
+    hackname  = glibc_c99_inline_4;
+    files     = sys/sysmacros.h;
+    bypass    = "__STDC_VERSION__";
+    c_fix     = format;
+    c_fix_arg = "\n#if __STDC_VERSION__ < 19901L\nextern\n#endif\n";
+    c_fix_arg = "extern";
+    test_text = <<-EOT
+__extension__ extern __inline unsigned int
+EOT;
+};
+
+
 /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
  *  so we replace them with versions that correspond to the
  *  definition.
diff --git a/fixincludes/tests/base/bits/string2.h b/fixincludes/tests/base/bits/string2.h
new file mode 100644 (file)
index 0000000..0d37faa
--- /dev/null
@@ -0,0 +1,18 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+       "fixinc/tests/inc/bits/string2.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( GLIBC_C99_INLINE_3_CHECK )
+# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L
+#  define __STRING_INLINE inline
+# else
+#  define __STRING_INLINE extern __inline
+# endif
+#endif  /* GLIBC_C99_INLINE_3_CHECK */
index c2b2fb6..51fe835 100644 (file)
 #endif  /* ALPHA___EXTERN_PREFIX_SYS_STAT_CHECK */
 
 
+#if defined( GLIBC_C99_INLINE_2_CHECK )
+#if __STDC_VERSION__ < 199901L
+extern
+#endif
+__inline__ int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+#if __STDC_VERSION__ < 199901L
+extern
+#endif
+__inline__ int
+__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
+{}
+#endif  /* GLIBC_C99_INLINE_2_CHECK */
+
+
 #if defined( RS6000_FCHMOD_CHECK )
 extern int fchmod(int, mode_t);
 #endif  /* RS6000_FCHMOD_CHECK */
diff --git a/fixincludes/tests/base/sys/sysmacros.h b/fixincludes/tests/base/sys/sysmacros.h
new file mode 100644 (file)
index 0000000..6891a67
--- /dev/null
@@ -0,0 +1,18 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+       "fixinc/tests/inc/sys/sysmacros.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( GLIBC_C99_INLINE_4_CHECK )
+__extension__ 
+#if __STDC_VERSION__ < 19901L
+extern
+#endif
+ __inline unsigned int
+#endif  /* GLIBC_C99_INLINE_4_CHECK */