[updated 2.6 patch] #define inline as __attribute__((always_inline)) also for gcc >= 3.4
From: Adrian Bunk
Date: Mon Jul 12 2004 - 20:05:20 EST
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@xxxxxxxx>).
Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>
--- 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/