From 7683dcd8f8e26a944623c1dca233b06def69e25b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 2 Jan 2009 10:25:51 -0800 Subject: [PATCH] --- yaml --- r: 125094 b: refs/heads/master c: d2fde28ce793c09c1ea36d981cb6765174fd1eea h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/compiler-gcc.h | 5 +++++ trunk/include/linux/compiler-gcc3.h | 3 --- trunk/include/linux/compiler-gcc4.h | 8 +++++--- trunk/include/linux/compiler.h | 8 ++------ trunk/init/main.c | 9 --------- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index 0c0f7fef0308..8269080d2cc4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e65f0f8271b1b0452334e5da37fd35413a000de4 +refs/heads/master: d2fde28ce793c09c1ea36d981cb6765174fd1eea diff --git a/trunk/include/linux/compiler-gcc.h b/trunk/include/linux/compiler-gcc.h index 5c8351b859f0..af40f8eb86f0 100644 --- a/trunk/include/linux/compiler-gcc.h +++ b/trunk/include/linux/compiler-gcc.h @@ -61,3 +61,8 @@ #define noinline __attribute__((noinline)) #define __attribute_const__ __attribute__((__const__)) #define __maybe_unused __attribute__((unused)) + +#define __gcc_header(x) #x +#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) +#define gcc_header(x) _gcc_header(x) +#include gcc_header(__GNUC__) diff --git a/trunk/include/linux/compiler-gcc3.h b/trunk/include/linux/compiler-gcc3.h index e5eb795f78a1..2befe6513ce4 100644 --- a/trunk/include/linux/compiler-gcc3.h +++ b/trunk/include/linux/compiler-gcc3.h @@ -2,9 +2,6 @@ #error "Please don't include directly, include instead." #endif -/* These definitions are for GCC v3.x. */ -#include - #if __GNUC_MINOR__ >= 3 # define __used __attribute__((__used__)) #else diff --git a/trunk/include/linux/compiler-gcc4.h b/trunk/include/linux/compiler-gcc4.h index 974f5b7bb205..09992718f9e8 100644 --- a/trunk/include/linux/compiler-gcc4.h +++ b/trunk/include/linux/compiler-gcc4.h @@ -2,8 +2,10 @@ #error "Please don't include directly, include instead." #endif -/* These definitions are for GCC v4.x. */ -#include +/* GCC 4.1.[01] miscompiles __weak */ +#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 +# error Your version of gcc miscompiles the __weak directive +#endif #define __used __attribute__((__used__)) #define __must_check __attribute__((warn_unused_result)) @@ -16,7 +18,7 @@ */ #define uninitialized_var(x) x = x -#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) +#if __GNUC_MINOR__ >= 3 /* Mark functions as cold. gcc will assume any path leading to a call to them will be unlikely. This means a lot of manual unlikely()s are unnecessary now for any paths leading to the usual suspects diff --git a/trunk/include/linux/compiler.h b/trunk/include/linux/compiler.h index ea7c6be354b7..d95da1020f1c 100644 --- a/trunk/include/linux/compiler.h +++ b/trunk/include/linux/compiler.h @@ -36,12 +36,8 @@ extern void __chk_io_ptr(const volatile void __iomem *); #ifdef __KERNEL__ -#if __GNUC__ >= 4 -# include -#elif __GNUC__ == 3 && __GNUC_MINOR__ >= 2 -# include -#else -# error Sorry, your compiler is too old/not recognized. +#ifdef __GNUC__ +#include #endif #define notrace __attribute__((no_instrument_function)) diff --git a/trunk/init/main.c b/trunk/init/main.c index f5e64f20d2b0..ad8f9f53f8d1 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -75,15 +75,6 @@ #include #endif -/* - * This is one of the first .c files built. Error out early if we have compiler - * trouble. - */ - -#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0 -#warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended. -#endif - static int kernel_init(void *); extern void init_IRQ(void);