This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: How to handle c99 inline changes? [was RE: -fkeep-inline-functions and broken Cygwin bootstrap (was: Building GCC 4.3.0 on Cygwin...)]
On 28 March 2007 15:14, Ian Lance Taylor wrote:
> "Dave Korn" <dave.korn@artimi.com> writes:
>
>> So, am I correct to believe that we need to use plain 'inline' for c99
>> after gcc 4.4, and 'extern inline' before that? That is, I think I need
>> to write a test that looks like...
>>
>>
>> #if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))) \
>> && defined (__STRICT_ANSI__) && (__STRICT_ANSI__ != 0) \
>> && defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
>> #define ELIDABLE_INLINE inline
>> #else
>> #define ELIDABLE_INLINE extern inline
>> #endif
>
> It's simpler than that. I defined new preprocessor macros
> specifically to avoid this complexity. Here is one approach that
> should work;
>
> #ifdef __GNUC_STDC_INLINE__
> #define ELIDABLE_INLINE inline
> #else
> #define ELIDABLE_INLINE extern inline
> #endif
Fantastic! That's of course far better than trying to duplicate the logic
in two places and get it right. Thanks a bunch! <scuttles off in general
direction of newlib list>
cheers,
DaveK
--
Can't think of a witty .sigline today....