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]

add #define to revert C99 inlining behaviour


Apparently it is 'controversial' that -std=c99 should implement C99.

So, here is a #define.  You can switch it off, on again, off again, on
again, and so on, to your heart's delight.

Lightly tested on i686-apple-darwin9.
-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-c99inline-lightswitch.patch===========
2006-11-03  Geoffrey Keating  <geoffk@apple.com>

	* c-decl.c (WANT_C99_INLINE_SEMANTICS): New, set to 1.
	(merge_decls): Implement WANT_C99_INLINE_SEMANTICS.
	(grokdeclarator): Likewise.

Index: c-decl.c
===================================================================
--- c-decl.c	(revision 118397)
+++ c-decl.c	(working copy)
@@ -62,6 +62,12 @@
 #include "langhooks-def.h"
 #include "pointer-set.h"
 
+/* Set this to 1 if you want the standard ISO C99 semantics of 'inline'
+   when you specify -std=c99 or -std=gnuc99, and to 0 if you want
+   behaviour compatible with the nonstandard semantics implemented by
+   GCC 2.95 through 4.2.  */
+#define WANT_C99_INLINE_SEMANTICS 1
+
 /* In grokdeclarator, distinguish syntactic contexts of declarators.  */
 enum decl_context
 { NORMAL,			/* Ordinary declaration */
@@ -1760,6 +1766,7 @@
 	}
     }
 
+#if WANT_C99_INLINE_SEMANTICS
    /* In c99, 'extern' declaration before (or after) 'inline' means this
       function is not DECL_EXTERNAL.  */
    if (TREE_CODE (newdecl) == FUNCTION_DECL
@@ -1771,6 +1778,7 @@
        && DECL_EXTERNAL (newdecl)
        && flag_isoc99)
      DECL_EXTERNAL (newdecl) = 0;
+#endif /* WANT_C99_INLINE_SEMANTICS */
 
   if (DECL_EXTERNAL (newdecl))
     {
@@ -4772,7 +4780,11 @@
 	   in this file, C99 6.7.4p6.  In GNU C89, a function declared
 	   'extern inline' is an external reference.  */
 	else if (declspecs->inline_p && storage_class != csc_static)
+#if WANT_C99_INLINE_SEMANTICS
 	  DECL_EXTERNAL (decl) = (storage_class == csc_extern) == !flag_isoc99;
+#else
+	  DECL_EXTERNAL (decl) = (storage_class == csc_extern);
+#endif
 	else
 	  DECL_EXTERNAL (decl) = !initialized;
 
============================================================


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