[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] inline.h should not define inline functions with "extern" li

From: Matthias Koeppe
Subject: Re: [Patch] inline.h should not define inline functions with "extern" linkage
Date: Mon, 23 Jun 2003 10:40:40 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.3.50 (sparc-sun-solaris2.8)

Kevin Ryde <address@hidden> writes:

> Matthias Koeppe <address@hidden> writes:
>> The "inline" keyword does not imply static linkage, and in fact
>> inline.h defines the functions `scm_cell' and `scm_double_cell'
>> explicitly with "extern" linkage.  
> "extern inline" is a gcc-ism, as far as I'm aware.  We use it in
> gmp.h, but only with gcc.


>> The patch below fixes it.  inline.c defines the functions with
>> external linkage, and every file including inline.h defines static
>> inline copies.
> One possibility would be to do these things as macros, so as to avoid
> depending on the compiler having an inline, or whether it only
> actually inlines at certain optimization levels.
> You can imagine the sort of thing, setting a variable given to the
> macro, rather than a return value,
> #define SCM_I_MKBIG(big)
>   do {
>     SCM  __scm_i_mkbig__temp = scm_double_cell (scm_tc16_big, 0, 0, 0);
>     mpz_init (SCM_I_BIG_MPZ (__scm_i_mkbig__temp));
>     (big) = __scm_i_mkbig__temp;
>   } while (0)

CVS Guile uses a different method to deal with possibly inlined

inline.c defines ("extern", non-"inline") versions for use in
user programs.

If the C compiler recognizes an "inline" keyword, inline.h defines
"inline" versions of the functions.  However, there the gcc-ism of
"extern inline" was used.  My patch gets rid of this gcc-ism.  This
makes the compilation work with the Sun Forte compiler.

I have adapted this approach to the inline functions in numbers.c.

Matthias Koeppe --

reply via email to

[Prev in Thread] Current Thread [Next in Thread]