lkml.org 
[lkml]   [2005]   [Sep]   [6]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
From(H. Peter Anvin)
SubjectRe: [discuss] [2.6 patch] include/asm-x86_64 "extern inline" -> "static inline"
DateTue, 6 Sep 2005 04:38:47 +0000 (UTC)
Followup to:  <20050905190014.GB3776@stusta.de>
By author:    Adrian Bunk <bunk@stusta.de>
In newsgroup: linux.dev.kernel
>
> On Mon, Sep 05, 2005 at 02:47:40PM -0400, Jakub Jelinek wrote:
> > On Mon, Sep 05, 2005 at 08:00:05PM +0200, Adrian Bunk wrote:
> > > It isn't the same, but "static inline" is the correct variant.
> > > 
> > > "extern inline __attribute__((always_inline))" (which is what
> > > "extern inline" is expanded to) doesn't make sense.
> > 
> > It does make sense and is different from
> > static inline __attribute__((always_inline)).
> > Try:
> > static inline __attribute__((always_inline)) void foo (void) {}
> > void (*fn)(void) = foo;
> > vs.
> > extern inline __attribute__((always_inline)) void foo (void) {}
> > void (*fn)(void) = foo;
> > In the former case, GCC will emit the out of line static copy of foo
> > if you take its address, in the latter case either you provide foo
> > function by other means, or you get linker error.
> 
> And we need the former case because in the kernel we do not have 
> out-of-line variants of the inline functions.
> 

UNLESS the function is broken if out-of-lined.  If the function cannot
be safely out-of-lined, extern inline MUST be used.

	-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-06 04:42    [W:0.627 / U:1.100 seconds]
©2003-2008 Jasper Spaans