public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@fs.tum.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@muc.de>,
	aoliva@redhat.com, ncunningham@linuxmail.org,
	linux-kernel@vger.kernel.org
Subject: [updated 2.6 patch] #define inline as __attribute__((always_inline)) also for gcc >= 3.4
Date: Tue, 13 Jul 2004 03:02:40 +0200	[thread overview]
Message-ID: <20040713010239.GG4701@fs.tum.de> (raw)
In-Reply-To: <200407111501.21769.arnd@arndb.de>

On Sun, Jul 11, 2004 at 03:01:18PM +0200, Arnd Bergmann wrote:
> On Sonntag, 11. Juli 2004 13:50, Adrian Bunk wrote:
> > -#if __GNUC_MINOR__ >= 1  && __GNUC_MINOR__ < 4
> > +#if __GNUC_MINOR__ >= 1
> >  # define inline                __inline__ __attribute__((always_inline))
> >  # define __inline__    __inline__ __attribute__((always_inline))
> >  # define __inline      __inline__ __attribute__((always_inline))
> 
> While we're there, shouldn't this really be the following?
> 
> # define inline          inline   __attribute__((always_inline))
> # define __inline__    __inline__ __attribute__((always_inline))
> # define __inline      __inline   __attribute__((always_inline))
> 
> I find it somewhat annoying that the preprocessor expands every "inline"
> to "__inline__ __attribute__((always_inline)) __attribute__((always_inline))"
> in the current code.

Sounds like a good idea.

Updated patch below.

> 	Arnd <><

<--  snip  -->

[patch] #define inline as __attribute__((always_inline)) also for gcc >= 3.4


Rationale:
- if gcc 3.4 can't inline a function marked as "inline" that's a
  strong hint that further investigation is required
- I strongly prefer a compile error over a potential runtime problem


Additionally, it changes all #define's to expand to the correct
{,__}inline{,__} (suggested by Arnd Bergmann <arnd@arndb.de>).


Signed-off-by: Adrian Bunk <bunk@fs.tum.de>

--- linux-2.6.7-mm7-full-gcc3.4/include/linux/compiler-gcc3.h.old	2004-07-13 02:56:53.000000000 +0200
+++ linux-2.6.7-mm7-full-gcc3.4/include/linux/compiler-gcc3.h	2004-07-13 02:58:03.000000000 +0200
@@ -3,10 +3,10 @@
 /* These definitions are for GCC v3.x.  */
 #include <linux/compiler-gcc.h>
 
-#if __GNUC_MINOR__ >= 1  && __GNUC_MINOR__ < 4
-# define inline		__inline__ __attribute__((always_inline))
-# define __inline__	__inline__ __attribute__((always_inline))
-# define __inline	__inline__ __attribute__((always_inline))
+#if __GNUC_MINOR__ >= 1
+# define inline		inline		__attribute__((always_inline))
+# define __inline__	__inline__	__attribute__((always_inline))
+# define __inline	__inline	__attribute__((always_inline))
 #endif
 
 #if __GNUC_MINOR__ > 0



      reply	other threads:[~2004-07-13  1:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2fFzK-3Zz-23@gated-at.bofh.it>
     [not found] ` <2fG2F-4qK-3@gated-at.bofh.it>
     [not found]   ` <2fG2G-4qK-9@gated-at.bofh.it>
     [not found]     ` <2fPfF-2Dv-21@gated-at.bofh.it>
     [not found]       ` <2fPfF-2Dv-19@gated-at.bofh.it>
2004-07-09  4:51         ` GCC 3.4 and broken inlining Andi Kleen
2004-07-09  4:56           ` Nigel Cunningham
2004-07-09  5:46             ` Andi Kleen
2004-07-09  9:43               ` Michael Buesch
2004-07-09 10:23                 ` Paweł Sikora
2004-07-10 21:33             ` Alexandre Oliva
2004-07-11  5:52               ` Andi Kleen
2004-07-14  3:00                 ` Alexandre Oliva
2004-07-09 18:40           ` Adrian Bunk
2004-07-09 21:54             ` Andi Kleen
2004-07-09 22:17               ` Adrian Bunk
2004-07-10  4:50                 ` Andi Kleen
2004-07-10 21:25           ` Alexandre Oliva
2004-07-11  5:53             ` Andi Kleen
2004-07-11  6:55               ` Andrew Morton
2004-07-11  8:26                 ` Andi Kleen
2004-07-11  8:32                   ` Andrew Morton
2004-07-11  9:08                     ` Andi Kleen
2004-07-11 11:50                     ` Adrian Bunk
2004-07-11 13:01                       ` Arnd Bergmann
2004-07-13  1:02                         ` Adrian Bunk [this message]

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20040713010239.GG4701@fs.tum.de \
    --to=bunk@fs.tum.de \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=aoliva@redhat.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncunningham@linuxmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox