Re: [2.6 patch] kill __always_inline

From: Adrian Bunk (bunk_at_fs.tum.de)
Date: 09/02/04

  • Next message: Chris Wedgwood: "Re: [PATCH] i386 reduce spurious interrupt noise"
    Date:	Thu, 2 Sep 2004 21:46:00 +0200
    To: Andrew Morton <akpm@osdl.org>
    
    

    On Tue, Aug 31, 2004 at 04:39:14PM -0700, Andrew Morton wrote:
    > Nigel Cunningham <ncunningham@linuxmail.org> wrote:
    > >
    > > Hi.
    > >
    > > On Wed, 2004-09-01 at 08:52, Adrian Bunk wrote:
    > > > On Tue, Aug 31, 2004 at 03:36:49PM -0700, Andrew Morton wrote:
    > > > > Adrian Bunk <bunk@fs.tum.de> wrote:
    > > > > >
    > > > > > An issue that we already discussed at 2.6.8-rc2-mm2 times:
    > > > > >
    > > > > > 2.6.9-rc1 includes __always_inline which was formerly in -mm.
    > > > > > __always_inline doesn't make any sense:
    > > > > >
    > > > > > __always_inline is _exactly_ the same as __inline__, __inline and inline .
    > > > > >
    > > > > >
    > > > > > The patch below removes __always_inline again:
    > > > >
    > > > > But what happens if we later change `inline' so that it doesn't do
    > > > > the `always inline' thing?
    > > > >
    > > > > An explicit usage of __always_inline is semantically different than
    > > > > boring old `inline'.
    > >
    > > Excuse me if I'm being ignorant, but I thought always_inline was
    > > introduced because with some recent versions of gcc, inline wasn't doing
    > > the job (suspend2, which requires a working inline, was broken by it for
    > > example).
    >
    > IIRC, the compiler was generating out-of-line versions of functions in
    > every compilation unit whcih included the header file. When we the
    > developers just wanted `inline' to mean `inline, dammit'.

    `inline, dammit' is
      __attribute__((always_inline))

    The original `inline' never guarantees that the function will be
    inlined.

    Therefore, `inline' is already #define'd in the Linux kernel to always
    be __attribute__((always_inline)).

    > If that broke swsusp in some manner then the relevant swsusp functions
    > should be marked always_inline, because they have some special needs.
    >
    > > That is to say, doesn't the definition of always_inline vary
    > > with the compiler version?
    >
    > If the compiler supports attribute((always_inline)) then the kernel build
    > system will use that. If the compiler doesn't support
    > attribute((always_inline)) then we just emit `inline' from cpp and hope
    > that it works out.

    That's exactly how `inline' is already #define'd in the Linux kernel.

    And __always_inline is currently simply #define'd to `inline' ...

    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 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/
    

  • Next message: Chris Wedgwood: "Re: [PATCH] i386 reduce spurious interrupt noise"

    Relevant Pages

    • Re: RAD Studio Roadmap Updated
      ... Strict private and strict protected provide a means for the compiler ... It will comply according to the specification (of the inline ... the exposure of the implementation details is CRITICAL ...
      (borland.public.delphi.non-technical)
    • Re: OT: C++ overloading operators
      ... way before complex numbers were part of the STL. ... I used the INLINE directive for these trivial functions. ... A compiler can not do inlining without access to the source code. ...
      (comp.dsp)
    • Re: [PATCH] Inline vfat_strnicmp()
      ... >> big inlined statics get called from more that one callsite, ... >> and it will be automatically handled by smarter compiler someday, ... > that inline. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: HLA
      ... inline assembler for that compiler. ... different beast from a standalone assembler and IMHO, HLA is most ... It could be added to almost any C compiler without problems... ... then you're no longer programming in the standard form of the ...
      (alt.lang.asm)
    • Re: introspection in SML
      ... inline and notinline declarations, and compiler macros. ... still sometimes do it, but with a compiler like MLton, I don't have ... noticed that it did fewer calls to arbitrary precision ...
      (comp.lang.functional)