On 7 Apr 2012, at 18:10, David Schultz wrote:

> The biggest hinderance to using extern inline is that gcc and C99
> disagree about what it means, unless you use a reasonably recent
> compiler in C99 mode.  I first tried to use extern inline in the
> tree several years after I backported gcc's C99 inline support,
> and it still turned out to be a headache.

You can detect which inlining mode is going to happen by checking the value of 
__STDC_VERSION__ and the value of __GNUC_GNU_INLINE__.  If __STDC_VERSION__ is 
>= 199901L and __GNUC_GNU_INLINE__ is not defined then you're in C99 inlining 
mode, otherwise you're in GNU inlining mode.  

On some projects with headers that need to work in both modes, we've written 
some INLINE_EXTERN macros that do the right thing in whichever mode we find 
ourselves compiling.  It might be worth putting these in cdefs.h if they're 
generally useful.

David_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to