LKML Archive on
help / color / mirror / Atom feed
From: "Robert P. J. Day" <>
To: Pekka Enberg <>
Cc: Linux kernel mailing list <>
Subject: Re: can someone explain "inline" once and for all?
Date: Fri, 19 Jan 2007 08:19:37 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701190805360.25200@CPE00045a9c397f-CM001225dbafb6> (raw)
In-Reply-To: <>

On Fri, 19 Jan 2007, Pekka Enberg wrote:

> On 1/19/07, Robert P. J. Day <> wrote:
> > is there a simple explanation for how to *properly* define inline
> > routines in the kernel?  and maybe this can be added to the
> > CodingStyle guide (he mused, wistfully).
> AFAIK __always_inline is the only reliable way to force inlining
> where it matters for correctness (for example, when playing tricks
> with __builtin_return_address like we do in the slab).
> Anything else is just a hint to the compiler that might be ignored
> if the optimizer thinks it knows better.

  oh, *that* part i knew.  what i don't understand is the difference
between "inline", "__inline" and "__inline__".  you can see in

# undef inline
# undef __inline__
# undef __inline
# define inline                 inline          __attribute__((always_inline))
# define __inline__             __inline__      __attribute__((always_inline))
# define __inline               __inline        __attribute__((always_inline))

  so that header file certainly suggests that there's some sort of
difference.  after which it gets even more confusing as various macros
seem to mix and match:

  drivers/cdrom/sbpcd.c:#define INLINE inline
  arch/arm/nwfpe/ARM-gcc.h:#define INLINE extern __inline__
  arch/cris/arch-v10/kernel/fasttimer.c:#define __INLINE__ inline
  arch/alpha/mm/fault.c:#define __EXTERN_INLINE inline
  ... etc etc ...

  i mean, how many different kinds of inline *are* there?


p.s.  apparently, some of the alpha people are less than thrilled with
the situation:


#ifdef __KERNEL__
/* Some idiots over in <linux/compiler.h> thought inline should imply
   always_inline.  This breaks stuff.  We'll include this file whenever
   we run into such problems.  */

#include <linux/compiler.h>
#undef inline
#undef __inline__
#undef __inline
#undef __always_inline
#define __always_inline         inline __attribute__((always_inline))

#endif /* __KERNEL__ */

  reply	other threads:[~2007-01-19 13:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 11:56 Robert P. J. Day
2007-01-19 13:01 ` Pekka Enberg
2007-01-19 13:19   ` Robert P. J. Day [this message]
2007-01-19 14:13   ` Adrian Bunk
2007-01-19 14:44     ` Robert P. J. Day
2007-01-19 14:53     ` Robert P. J. Day
2007-01-19 13:37 ` Andreas Schwab
2007-01-19 13:48   ` Robert P. J. Day
2007-01-19 13:58     ` Andreas Schwab
2007-01-19 14:00       ` Robert P. J. Day
2007-01-19 17:15 ` Alexandre Oliva
2007-01-19 17:36   ` Adrian Bunk

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0701190805360.25200@CPE00045a9c397f-CM001225dbafb6 \ \ \ \
    --subject='Re: can someone explain "inline" once and for all?' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).