* [PATCH] fix "extern inline"
@ 2004-11-10 4:55 Yoshinori Sato
2004-12-01 1:33 ` "extern inline" purge? was: " Andrew Grover
0 siblings, 1 reply; 3+ messages in thread
From: Yoshinori Sato @ 2004-11-10 4:55 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
===== include/linux/bitops.h 1.6 vs edited =====
--- 1.6/include/linux/bitops.h 2004-05-03 05:04:34 +09:00
+++ edited/include/linux/bitops.h 2004-11-08 15:36:48 +09:00
@@ -42,7 +42,7 @@
* fls: find last bit set.
*/
-extern __inline__ int generic_fls(int x)
+static __inline__ int generic_fls(int x)
{
int r = 32;
@@ -71,7 +71,7 @@
return r;
}
-extern __inline__ int get_bitmask_order(unsigned int count)
+static __inline__ int get_bitmask_order(unsigned int count)
{
int order;
--
Yoshinori Sato
<ysato@users.sourceforge.jp>
^ permalink raw reply [flat|nested] 3+ messages in thread
* "extern inline" purge? was: Re: [PATCH] fix "extern inline"
2004-11-10 4:55 [PATCH] fix "extern inline" Yoshinori Sato
@ 2004-12-01 1:33 ` Andrew Grover
2004-12-01 8:43 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Grover @ 2004-12-01 1:33 UTC (permalink / raw)
To: linux-kernel
On Wed, 10 Nov 2004 13:55:23 +0900, Yoshinori Sato
<ysato@users.sourceforge.jp> wrote:
> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> -extern __inline__ int generic_fls(int x)
> +static __inline__ int generic_fls(int x)
Along the lines of this patch, can I ask... if a patch were created to
replace all instances of "extern inline" with "static inline" would
that be a good thing or a waste of time? I found a 3 year old thread
(Jul 27 2001, "Re: [PATCH] gcc-3.0.1 and 2.4.7-ac1") where it sounded
like a good thing to do, but obviously there are some still around.
Regards -- Andy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: "extern inline" purge? was: Re: [PATCH] fix "extern inline"
2004-12-01 1:33 ` "extern inline" purge? was: " Andrew Grover
@ 2004-12-01 8:43 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2004-12-01 8:43 UTC (permalink / raw)
To: Andrew Grover; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
On Middeweken 01 Dezember 2004 02:33, Andrew Grover wrote:
> On Wed, 10 Nov 2004 13:55:23 +0900, Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> > -extern __inline__ int generic_fls(int x)
> > +static __inline__ int generic_fls(int x)
>
> Along the lines of this patch, can I ask... if a patch were created to
> replace all instances of "extern inline" with "static inline" would
> that be a good thing or a waste of time? I found a 3 year old thread
> (Jul 27 2001, "Re: [PATCH] gcc-3.0.1 and 2.4.7-ac1") where it sounded
> like a good thing to do, but obviously there are some still around.
If anyone uses extern inline in the way that it is intended, i.e.
provide an inline function in a header and an out-of-line version
of the same function in some C file, that breaks.
It would be pointless to use extern inline this way now, since we define
inline to mean always_inline in the kernel, but gcc will give you a
compile error when it sees the same function defined both as 'static
inline' and as 'extern'. The correct fix is to convert 'extern inline'
to 'static inline' and at the same time remove any external definitions
of the same function.
Another point that has been mentioned before is that forcing inline
to always_inline is not really a good idea. My personal preference
would be to convert all uses of 'extern inline' that are meant as
'this breaks if it is not inline' to something like 'static
__always_inline' instead of plain 'static inline'. Then maybe some
day the annotations get good enough to leave the decision
to the compiler for the regular case.
Arnd <><
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-01 8:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-10 4:55 [PATCH] fix "extern inline" Yoshinori Sato
2004-12-01 1:33 ` "extern inline" purge? was: " Andrew Grover
2004-12-01 8:43 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).