This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
c99 fixincludes for glibc, committed version
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Nov 2006 19:11:40 -0800 (PST)
- Subject: c99 fixincludes for glibc, committed version
This is what I am committing.
It successfully bootstraps on i686-pc-linux-gnu, and the compiler
dejagnu testsuites show no regressions relative to
<http://gcc.gnu.org/ml/gcc-testresults/2006-10/msg01462.html>.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/gcc-fixinc-linuxc99inline-2.patch=========
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.
Index: tests/base/bits/string2.h
===================================================================
--- tests/base/bits/string2.h (revision 0)
+++ tests/base/bits/string2.h (revision 0)
@@ -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: tests/base/sys/stat.h
===================================================================
--- tests/base/sys/stat.h (revision 118397)
+++ tests/base/sys/stat.h (working copy)
@@ -14,6 +14,20 @@
#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 */
Index: tests/base/sys/sysmacros.h
===================================================================
--- tests/base/sys/sysmacros.h (revision 0)
+++ tests/base/sys/sysmacros.h (revision 0)
@@ -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 */
Index: inclhack.def
===================================================================
--- inclhack.def (revision 118397)
+++ inclhack.def (working copy)
@@ -1289,6 +1289,81 @@
};
+/*
+ * 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.
============================================================