This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
egcs & extern inline
- To: libc-hacker@cygnus.com
- Subject: egcs & extern inline
- From: "Mark M. Kettenis" <kettenis@wins.uva.nl>
- Date: Tue, 9 Feb 1999 11:02:56 +0100 (MET)
I just noticed a thread on the egcs mailing list a thread discussing
the ``extern inline'' extension (kernel-2.2.1-undefined references).
Apparently Linus Torvalds has some trouble reading the documentation
and expects functions declared as ``extern inline'' to be always
inlined. The gcc say:
If you specify both `inline' and `extern' in the function
definition, then the definition is used only for inlining. In no case
is the function compiled on its own, not even if you refer to its
address explicitly. Such an address becomes an external reference, as
if you had only declared the function, and had not defined it.
This combination of `inline' and `extern' has almost the effect of a
macro. The way to use it is to put a function definition in a header
file with these keywords, and put another copy of the definition
(lacking `inline' and `extern') in a library file. The definition in
the header file will cause most calls to the function to be inlined.
If any uses of the function remain, they will refer to the single copy
in the library.
We pretty much depend on the current (and IMHO properly documented)
behaviour of ``extern inline''. We do exactly what the last paragraph
says.
However there have been some suggestions to generate errors or
warnings if such a function cannot be inlined. We'll have to make
sure this doesn't happen. I already posted a message to the egcs
mailing list, but I think we should keep our eyes open.
Mark