This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Handling of extern inline in c99 mode
On Wed, 1 Nov 2006, Daniel Jacobowitz wrote:
> On Wed, Nov 01, 2006 at 06:59:42PM +0000, Joseph S. Myers wrote:
> > I'd rather simply fix glibc to work with C99 inline semantics. For the
> > above you might use
> >
> > #define tolower(c) __tolower_inline(c)
> > static __inline __attribute__((__always_inline__)) int tolower_inline ...
> >
> > and #undef tolower when defining the out of line function. That would
> > apply to all cases where a user-visible function in a header is currently
> > inlined directly; for a purely internal function in the header, we can
> > arrange for all declarations to use "inline" without "extern" when in C99
> > mode.
>
> Isn't the whole point that the current extern inline isn't
> __always_inline__, but leaves it to the compiler's judgement?
In most cases where glibc isn't using always_inline that's a mistake
because the glibc code predates always_inline. (For example, the inlines
in sys/stat.h clearly should be always_inline.)
If the extern inline function shouldn't be always_inline and only exists
as an inline, glibc already arranges code to export the inline versions
from the header into the library.
If it shouldn't be always_inline and has an exported version, then the
__foo_inline could be made an alias for the real function.
--
Joseph S. Myers
joseph@codesourcery.com