[patch 7/7] Make "inline" no longer mandatory for gcc 4.x

Arjan van de Ven
2006-01-06T10:46:23Z

Subject: when CONFIG_CC_OPTIMIZE_FOR_SIZE, allow gcc4 to control inlining
From: Ingo Molnar <mingo@elte.hu>

if optimizing for size (CONFIG_CC_OPTIMIZE_FOR_SIZE), allow gcc4 compilers
to decide what to inline and what not - instead of the kernel forcing gcc
to inline all the time. This requires several places that require to be
inlined to be marked as such, previous patches in this series do that.
This is probably the most flame-worthy patch of the series.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@infradead.org>

----

include/linux/compiler-gcc4.h | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6.15/include/linux/compiler-gcc4.h
===================================================================
--- linux-2.6.15.orig/include/linux/compiler-gcc4.h
+++ linux-2.6.15/include/linux/compiler-gcc4.h
@@ -3,9 +3,11 @@
/* These definitions are for GCC v4.x. */
#include <linux/compiler-gcc.h>

-#define inline inline __attribute__((always_inline))
-#define __inline__ __inline__ __attribute__((always_inline))
-#define __inline __inline __attribute__((always_inline))
+#ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
+# define inline inline __attribute__((always_inline))
+# define __inline__ __inline__ __attribute__((always_inline))
+# define __inline __inline __attribute__((always_inline))
+#endif
#define __always_inline inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
#define __attribute_used__ __attribute__((__used__))