Re: [2.6 patch] include/linux/bio.h: "extern inline" -> "static inline"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 27, 2005 at 10:59:35AM -0400, Kimball Murray wrote:
> Jens Axboe wrote:
> 
> >On Tue, Jul 26 2005, Adrian Bunk wrote:
> > 
> >
> >>"extern inline" doesn't make much sense.
> >>   
> >>
> >
> >Yep, thanks.
> >
> > 
> >
> IIRC, there was a time when the extern inline construct was used to 
> catch cases where the compiler did not inline the function (you'd get a 
> link error).  Seems like it still works.  Try building the attached 
> files in each of the following ways:
> 
> gcc -o foo foo.c
> 
>    and
> 
> gcc -O2 -o foo foo.c
> 
> In the first case, you get a link error, because there is no inlining.

In the kernel, we have a
  # define inline         inline          __attribute__((always_inline))

This doesn't leave gcc any choice to not inline the function.

> -kimball

> #include "bar.h"
> 
> void foo(void) {
> 	bar();
> }
> 
> int main(int argc, char *argv[])
> {
> 	foo();
> 	return 0;
> }

> extern inline void bar(void)
> {
> }

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

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux