Patch to allow "inline" keyword in C99 mode

Joseph S. Myers jsm28@cam.ac.uk
Mon Jul 17 14:53:00 GMT 2000


Though C99 inline is very different from the GCC extension and the
semantics will need reimplementing for C99 mode following the standard
(the note in c99status.html that "C99 inline implies static" is not
precisely accurate, and simply doesn't cover the full
incompatibilities), it seems worthwhile to at least allow the "inline"
keyword in C99 mode now, which this patch does.

2000-07-16  Joseph S. Myers  <jsm28@cam.ac.uk>

	* c-lex.c (init_lex): Keep the "inline" keyword in C99 mode.
	(yylex): Don't pedwarn for "inline" in C99 mode.

--- c-lex.c	Thu Jul 13 12:46:12 2000
+++ c-lex.c.new	Sun Jul 16 15:05:43 2000
@@ -338,7 +338,8 @@
     {
       UNSET_RESERVED_WORD ("asm");
       UNSET_RESERVED_WORD ("typeof");
-      UNSET_RESERVED_WORD ("inline");
+      if (! flag_isoc99)
+	UNSET_RESERVED_WORD ("inline");
       UNSET_RESERVED_WORD ("iterator");
       UNSET_RESERVED_WORD ("complex");
     }
@@ -1402,7 +1403,7 @@
 	    /* Even if we decided to recognize asm, still perhaps warn.  */
 	    if (pedantic
 		&& (value == ASM_KEYWORD || value == TYPEOF
-		    || ptr->rid == RID_INLINE)
+		    || (ptr->rid == RID_INLINE && ! flag_isoc99))
 		&& token_buffer[0] != '_')
 	      pedwarn ("ANSI does not permit the keyword `%s'",
 		       token_buffer);

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list