Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[pandora-kernel.git] / include / linux / compiler-gcc.h
index 03ec231..5c8351b 100644 (file)
@@ -1,4 +1,6 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
+#endif
 
 /*
  * Common definitions for all gcc versions go here.
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
 
-#define inline         inline          __attribute__((always_inline))
-#define __inline__     __inline__      __attribute__((always_inline))
-#define __inline       __inline        __attribute__((always_inline))
+/*
+ * Force always-inline if the user requests it so via the .config,
+ * or if gcc is too old:
+ */
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+    !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+# define inline                inline          __attribute__((always_inline))
+# define __inline__    __inline__      __attribute__((always_inline))
+# define __inline      __inline        __attribute__((always_inline))
+#endif
+
 #define __deprecated                   __attribute__((deprecated))
 #define __packed                       __attribute__((packed))
 #define __weak                         __attribute__((weak))
 #define __naked                                __attribute__((naked))
 #define __noreturn                     __attribute__((noreturn))
+
+/*
+ * From the GCC manual:
+ *
+ * Many functions have no effects except the return value and their
+ * return value depends only on the parameters and/or global
+ * variables.  Such a function can be subject to common subexpression
+ * elimination and loop optimization just as an arithmetic operator
+ * would be.
+ * [...]
+ */
 #define __pure                         __attribute__((pure))
 #define __aligned(x)                   __attribute__((aligned(x)))
 #define __printf(a,b)                  __attribute__((format(printf,a,b)))
 #define  noinline                      __attribute__((noinline))
-#define __attribute_pure__             __attribute__((pure))
 #define __attribute_const__            __attribute__((__const__))
 #define __maybe_unused                 __attribute__((unused))