[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8bf23840962ec5a33b1bfae7fdf8b0a0f94c4227.1409949573.git.hannes@stressinduktion.org>
Date: Fri, 5 Sep 2014 22:39:58 +0200
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: linux-kernel@...r.kernel.org
Cc: Aaro Koskinen <aaro.koskinen@....fi>,
Sasha Levin <sasha.levin@...cle.com>, akpm@...uxfoundation.org,
mingo@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Joe Perches <joe@...ches.com>,
Richard Weinberger <richard.weinberger@...il.com>
Subject: [PATCH] gcc: clamp gcc version to most highest specific header version available
As announced in [1] gcc will increase its major number yearly but we don't
need to include gcc version specific quirks for every version normally.
This patch allows to compile every kernel with all new versions of gcc
without adding a specific compiler-gccX.h header. We do so by clamping
the __GNUC__ version to the most specific version dependent header file.
If someone adds a new gccX.h file __GCC_CLAMP_VERSION_HEADER also needs
to be modified.
The decision if chained including of header files (e.g. gcc5.h includes
gcc4.h) is necessary or should be avoided can be postponed until more
experience in using the official gcc release is gained.
Tested with gcc4 and gcc5.
[1] https://gcc.gnu.org/develop.html#num_scheme
Cc: Aaro Koskinen <aaro.koskinen@....fi>
Cc: Sasha Levin <sasha.levin@...cle.com>
Cc: akpm@...uxfoundation.org
Cc: mingo@...nel.org
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Joe Perches <joe@...ches.com>
Cc: Richard Weinberger <richard.weinberger@...il.com>
Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
---
include/linux/{compiler-gcc.h => compiler-gcc/gcc.h} | 12 ++++++++++--
include/linux/{compiler-gcc3.h => compiler-gcc/gcc3.h} | 0
include/linux/{compiler-gcc4.h => compiler-gcc/gcc4.h} | 0
include/linux/compiler.h | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
rename include/linux/{compiler-gcc.h => compiler-gcc/gcc.h} (91%)
rename include/linux/{compiler-gcc3.h => compiler-gcc/gcc3.h} (100%)
rename include/linux/{compiler-gcc4.h => compiler-gcc/gcc4.h} (100%)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc/gcc.h
similarity index 91%
rename from include/linux/compiler-gcc.h
rename to include/linux/compiler-gcc/gcc.h
index 02ae99e..0681fa3 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc/gcc.h
@@ -1,5 +1,5 @@
#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
+#error "Please don't include <linux/compiler-gcc/gcc.h> directly, include <linux/compiler.h> instead."
#endif
/*
@@ -101,9 +101,17 @@
#define __always_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(linux/compiler-gcc/gcc##x.h)
#define gcc_header(x) _gcc_header(x)
+
+/* increase this if you add a new compiler-gcc/gccX.h header file */
+#define __GCC_CLAMP_VERSION_HEADER 4
+
+#if __GNUC__ > __GCC_CLAMP_VERSION_HEADER
+#include gcc_header(__GCC_CLAMP_VERSION_HEADER)
+#else
#include gcc_header(__GNUC__)
+#endif
#if !defined(__noclone)
#define __noclone /* not needed */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc/gcc3.h
similarity index 100%
rename from include/linux/compiler-gcc3.h
rename to include/linux/compiler-gcc/gcc3.h
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc/gcc4.h
similarity index 100%
rename from include/linux/compiler-gcc4.h
rename to include/linux/compiler-gcc/gcc4.h
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d5ad7b1..06be28b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -51,7 +51,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#ifdef __KERNEL__
#ifdef __GNUC__
-#include <linux/compiler-gcc.h>
+#include <linux/compiler-gcc/gcc.h>
#endif
#define notrace __attribute__((no_instrument_function))
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists