This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA:] more glibc fixinclude adjustments for extern inline


Right, this is from the glibc-2.2.3 - 4 era, but as long as I
wrote this, here goes.

Of specific interest is the similarity of glibc_c99_inline_5
with glibc_c99_inline_4.  When I copied that recipe, the
alpha_wchar_check test was unexpectedly affected; its "extern
wchar_t *wcstok ..." declarations were wrapped too, for the
"extern" part.  Looking closer, it can't help but thinking
glibc_c99_inline_4 is a bit buggy:

fix = {
    hackname  = glibc_c99_inline_4;
    files     = sys/sysmacros.h, '*/sys/sysmacros.h';
    bypass    = "__STDC_VERSION__";
    select    = "extern __inline";
    c_fix     = format;
    c_fix_arg = "\n#ifdef __GNUC_GNU_INLINE__\nextern\n#endif\n";
    c_fix_arg = '(^| )extern ';
    test_text = <<-EOT
	__extension__ extern __inline unsigned int
	__extension__ __extern_inline unsigned int
	extern __inline unsigned int
	EOT;
};

What's the purpose of the second c_fix_arg?  By the effect it
appears to work as an alternative "select" line; *all*
occurrences of "(^|)extern " (not just those preceding "extern
__inline") will be replaced by the first c_fix_arg wrapping.  No
badness is expected to be caused by it, it was just a bit
confusing.  The posting of that patch doesn't make it clear it
was intended, though the ChangeLog explicitly mentions the
second c_fix_arg.

I called the new features.h recipe glibc_c99_inline_1a so the
features.h recipes would be together and before the "offenders"
of __USE_EXTERN_INLINES.  Oh, and it seems there never was a
tests/base/features.h added for glibc_c99_inline_1, so here is
one.

Either way, ok to commit?
:ADDPATCH fixincludes:

	* inclhack.def (glibc_c99_inline_1a, glibc_c99_inline_5): New.
	* fixincl.x: Regenerate.
	* tests/base/sys/wchar.h: Update.
	* tests/base/features.h: New.


Index: fixincludes/inclhack.def
===================================================================
--- fixincludes/inclhack.def	(revision 130927)
+++ fixincludes/inclhack.def	(working copy)
@@ -1346,7 +1346,24 @@
 EOT;
 };
 
+/*
+ *  Similar, but a version that didn't have __NO_INLINE__
+ */
+fix = {
+    hackname  = glibc_c99_inline_1a;
+    files     = features.h, '*/features.h';
+    select    = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
+		"(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
+    c_fix     = format;
+    c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
+    test_text = <<-EOT
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
+# 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.
@@ -1408,6 +1425,21 @@
 };
 
 
+fix = {
+    hackname  = glibc_c99_inline_5;
+    files     = wchar.h, '*/wchar.h';
+    bypass    = "__STDC_VERSION__";
+    select    = "extern __inline";
+    c_fix     = format;
+    c_fix_arg = "\n#ifdef __GNUC_GNU_INLINE__\nextern\n#endif\n__inline";
+    test_text = <<-EOT
+	__extension__ extern __inline double
+	__extension__ __extern_inline long
+	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.
Index: fixincludes/tests/base/wchar.h
===================================================================
--- fixincludes/tests/base/wchar.h	(revision 130927)
+++ fixincludes/tests/base/wchar.h	(working copy)
@@ -13,3 +13,18 @@
 extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__("wcstok_r");
 extern size_t   wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__("__wcsftime_isoc");
 #endif  /* ALPHA_WCHAR_CHECK */
+
+
+#if defined( GLIBC_C99_INLINE_5_CHECK )
+__extension__ 
+#ifdef __GNUC_GNU_INLINE__
+extern
+#endif
+__inline double
+__extension__ __extern_inline long
+
+#ifdef __GNUC_GNU_INLINE__
+extern
+#endif
+__inline unsigned int
+#endif  /* GLIBC_C99_INLINE_5_CHECK */
--- /dev/null	2007-12-04 21:23:27.128000250 +0100
+++ fixincludes/tests/base/features.h	2007-12-14 02:24:35.000000000 +0100
@@ -0,0 +1,23 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/features.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( GLIBC_C99_INLINE_1_CHECK )
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__     && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+# define __USE_EXTERN_INLINES	1
+#endif
+#endif  /* GLIBC_C99_INLINE_1_CHECK */
+
+
+#if defined( GLIBC_C99_INLINE_1A_CHECK )
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && (defined __extern_inline || defined __GNUC_GNU_INLINE__)
+# define __USE_EXTERN_INLINES	1
+#endif
+#endif  /* GLIBC_C99_INLINE_1A_CHECK */

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]