Skip to content

-std=c99 and inline semantics

3 messages · Marcus G. Daniels, Brian Ripley

#
Hi,

I noticed that with the GCC trunk (4.3.0), the semantics of "extern 
inline" have reversed.  
The net result is that R will build without the usual-stdc=gnu99 but it 
won't with it.
Many multiple definitions result otherwise. 

Marcus
#
As even 4.2.0 is not released yet, we will make changes at an appropriate 
time.  The GNU and C99 semantics for 'inline' are known to be 
incompatible.
/* this header is always to be included from others.
    It is only called if COMPILING_R is defined (in util.c) or
    from GNU C systems.

    There are different conventions for inlining across compilation units.
    We pro tem only use the GCC one.  See
    http://www.greenend.org.uk/rjk/2003/03/inline.html
*/

and note the 'pro tem'.
On Mon, 19 Mar 2007, Marcus G. Daniels wrote:

            

  
    
1 day later
#
The answer seems to be simple: add -fgnu89-inline, which will be available 
for gcc >= 4.1.3 (not yet released) according to the info files in the 
trunk.

BTW, the two OSes I tried the GCC trunk on (FC5 and MinGW) both had 
problems of their own with this change of semantics.  AFAICS, wchar.h in 
glibc 2.5 (the latest release) still does.  This is going to make for 
interesting times when you can choose on a per-compilation-unit (and not 
per-header) basis what the 'inline' semantics should be.
On Tue, 20 Mar 2007, Prof Brian Ripley wrote: