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]

Re: [patch] In C99, 'inline' may be doubled


On Thu, 13 Mar 2003, Michael Matz wrote:

> 6.7.4 #5 specifies that the 'inline' specifier may appear more than once.
> In current GCC (3.3 and HEAD) the below testcase leads to an error.  The
> below patch fixes that.  Bootstrapping/regtesting in progress on
> i686-linux.  OK if that passes (3.3 and HEAD)?

Fixing this one issue is just cosmetic and has little to do with the main 
issue of implementing C99 inline support.  The semantics of inline in C99 
are completely different from those in GNU C.  Unlike the idempotent type 
qualifiers that can arise naturally in conjunction with macros and where a 
C99 feature can naturally apply as an extension in gnu89, I can see no 
reason for duplicate inline to be accepted in gnu89 mode.

If you want to implement C99 inline, please do so.  (You'll need plenty of
testcases, including some involving linking or failing to link multiple
files.)  -std=gnu89 should keep the existing semantics (for both inline
and __inline__), but C99 mode (-std=c99, -std=gnu99) should use the C99
semantics (again, for both inline and __inline__).  It will be necessary
to do some fixincludes work to fix existing headers that use extern inline
with the GNU semantics, that are incompatible with the C99 ones.  
(Roughly, the semantics of plain inline and extern inline are swapped
between C99 and gnu89.  In C99, an inline function is exported only if
some declaration - possibly appearing after the function is defined -
specifies "extern" or does not specify "inline", whereas in gnu89 "extern
inline" means the function is not exported.)  Of course the manual needs
to explain both sets of semantics.

-- 
Joseph S. Myers
jsm28 at cam dot ac dot uk


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