aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 12:23:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 12:23:03 -0500
commitf153b82121b0366fe0e5f9553545cce237335175 (patch)
treecba4b60e9129fbcdfc254386954f0f17dba0c15d
parentb58602a4bac012b5f4fc12fe6b46ab237b610d5d (diff)
Sanitize gcc version header includes
- include the gcc version-dependent header files from the generic gcc header file, rather than the other way around (iow: don't make the non-gcc header file have to know about gcc versions) - don't include compiler-gcc4.h for gcc 5 (for whenever it gets released). That's just confusing and made us do odd things in the gcc4 header file (testing that we really had version 4!) - generate the name from the __GNUC__ version directly, rather than having a mess of #if conditionals. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/compiler-gcc.h5
-rw-r--r--include/linux/compiler-gcc3.h3
-rw-r--r--include/linux/compiler-gcc4.h5
-rw-r--r--include/linux/compiler.h8
4 files changed, 8 insertions, 13 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 5c8351b859f0..af40f8eb86f0 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -61,3 +61,8 @@
61#define noinline __attribute__((noinline)) 61#define noinline __attribute__((noinline))
62#define __attribute_const__ __attribute__((__const__)) 62#define __attribute_const__ __attribute__((__const__))
63#define __maybe_unused __attribute__((unused)) 63#define __maybe_unused __attribute__((unused))
64
65#define __gcc_header(x) #x
66#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
67#define gcc_header(x) _gcc_header(x)
68#include gcc_header(__GNUC__)
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index e5eb795f78a1..2befe6513ce4 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -2,9 +2,6 @@
2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5/* These definitions are for GCC v3.x. */
6#include <linux/compiler-gcc.h>
7
8#if __GNUC_MINOR__ >= 3 5#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 6# define __used __attribute__((__used__))
10#else 7#else
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 974f5b7bb205..aa426214331b 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -2,9 +2,6 @@
2#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5/* These definitions are for GCC v4.x. */
6#include <linux/compiler-gcc.h>
7
8#define __used __attribute__((__used__)) 5#define __used __attribute__((__used__))
9#define __must_check __attribute__((warn_unused_result)) 6#define __must_check __attribute__((warn_unused_result))
10#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 7#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
@@ -16,7 +13,7 @@
16 */ 13 */
17#define uninitialized_var(x) x = x 14#define uninitialized_var(x) x = x
18 15
19#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) 16#if __GNUC_MINOR__ >= 3
20/* Mark functions as cold. gcc will assume any path leading to a call 17/* Mark functions as cold. gcc will assume any path leading to a call
21 to them will be unlikely. This means a lot of manual unlikely()s 18 to them will be unlikely. This means a lot of manual unlikely()s
22 are unnecessary now for any paths leading to the usual suspects 19 are unnecessary now for any paths leading to the usual suspects
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ea7c6be354b7..d95da1020f1c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -36,12 +36,8 @@ extern void __chk_io_ptr(const volatile void __iomem *);
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38 38
39#if __GNUC__ >= 4 39#ifdef __GNUC__
40# include <linux/compiler-gcc4.h> 40#include <linux/compiler-gcc.h>
41#elif __GNUC__ == 3 && __GNUC_MINOR__ >= 2
42# include <linux/compiler-gcc3.h>
43#else
44# error Sorry, your compiler is too old/not recognized.
45#endif 41#endif
46 42
47#define notrace __attribute__((no_instrument_function)) 43#define notrace __attribute__((no_instrument_function))