This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: kernel-2.2.1-undefined references.
- To: torvalds at transmeta dot com (Linus Torvalds)
- Subject: Re: kernel-2.2.1-undefined references.
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Mon, 8 Feb 99 17:14:41 PST
- Cc: leei at ai dot sri dot com, ross dot s at ihug dot co dot nz, egcs at cygnus dot com, hpa at transmeta dot com
Linus writes, in response to a suggestion to use a special feature of
macros:
> Why don't you just remove "inline" completely, then?
>
> It's apparently ok to break documented and existing behaviour of "inline".
> Go read the gcc documentation about "extern inline", the whole thing is
> _designed_ to be a much more readable form of #define.
Hmm. Linus does seem to have a point here. See the node "Inline"
in the gcc manual.
" 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 seems to be a fairly strong promise that the function is guaranteed
to be either inline or to come out undefined (unless there is a second
non-extern-inline definition).
Many people have been answering based on general compiler principles
rather than by looking at the promises made in the gcc documentation for
an *extension*.