[PATCH] gcc3 does not inline some functions

From: Denis Vlasenko
Date: Sun Mar 21 2004 - 17:12:18 EST


# cut 2.4.25/System.map -d' ' -f3 | sort | uniq -c | sort -r | head -10
216 __constant_c_and_count_memset
120 __constant_memcpy
67 __constant_copy_to_user
66 __constant_copy_from_user
50 version
23 debug
17 max_interrupt_work
16 rx_copybreak
16 options
16 mdio_write

Fix is below. Backported from 2.6. Untested.
--
vda
--- linux-2.4.25/include/linux/compiler.h.orig Sun Mar 21 23:50:13 2004
+++ linux-2.4.25/include/linux/compiler.h Sun Mar 21 23:51:06 2004
@@ -13,4 +13,12 @@
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)

+#if __GNUC__ == 3
+#if __GNUC_MINOR__ >= 1
+# define inline __inline__ __attribute__((always_inline))
+# define __inline__ __inline__ __attribute__((always_inline))
+# define __inline __inline__ __attribute__((always_inline))
+#endif
+#endif
+
#endif /* __LINUX_COMPILER_H */