From: Adrian Bunk <bunk@stusta.de>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: matthew@wil.cx, parisc-linux@parisc-linux.org,
linux-kernel@vger.kernel.org
Subject: Re: [parisc-linux] [2.6 patch] parisc: "extern inline" -> "static
Date: Sun, 30 Oct 2005 18:14:31 +0100 [thread overview]
Message-ID: <20051030171431.GH4180@stusta.de> (raw)
In-Reply-To: <200510301642.j9UGgqp3000803@hiauly1.hia.nrc.ca>
On Sun, Oct 30, 2005 at 11:42:52AM -0500, John David Anglin wrote:
> > > I really don't think it makes any difference. Such a function (returning
> > > always 0) is always going to be inlined, and the only difference between
> > > static inline and extern inline is what happens when it can't be inlined.
> >
> > On !alpha we are defining inline to __attribute__((always_inline)) for
> > any non-ancient gcc making this a zero difference.
>
> It looks as if there are subtle differences between "always_inline"
> and "extern inline". From the GCC extensions document:
>
> [always_inline]
> Generally, functions are not inlined unless optimization is specified.
> For functions declared inline, this attribute inlines the function even
> if no optimization level was specified.
>
> [extern inline]
> If you specify both @code{inline} and @code{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.
>
> The primary difference between "static inline" and "extern inline"
> is in what happens when the address of the function is referenced.
> With "extern inline", you need a unique library function to resolve
> external references. With "static inline", you may end up with
> multiple copies of a function if its address is taken.
>...
In the kernel, "static inline" expands to
"static inline __attribute__((always_inline))" and
"extern inline" expands to
"extern inline __attribute__((always_inline))".
> Dave
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
next prev parent reply other threads:[~2005-10-30 17:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-30 0:03 [2.6 patch] parisc: "extern inline" -> "static inline" Adrian Bunk
2005-10-30 15:22 ` [parisc-linux] " Matthew Wilcox
2005-10-30 15:56 ` Adrian Bunk
2005-10-30 16:42 ` [parisc-linux] [2.6 patch] parisc: "extern inline" -> "static John David Anglin
2005-10-30 17:14 ` Adrian Bunk [this message]
2005-11-02 13:48 ` [parisc-linux] [2.6 patch] parisc: "extern inline" -> "static inline" Jan Engelhardt
2005-11-02 13:53 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051030171431.GH4180@stusta.de \
--to=bunk@stusta.de \
--cc=dave@hiauly1.hia.nrc.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=parisc-linux@parisc-linux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox