Skip to content
Commit 815f0ddb authored by Nick Desaulniers's avatar Nick Desaulniers Committed by Linus Torvalds
Browse files

include/linux/compiler*.h: make compiler-*.h mutually exclusive

Commit cafa0010 ("Raise the minimum required gcc version to 4.6")
recently exposed a brittle part of the build for supporting non-gcc
compilers.

Both Clang and ICC define __GNUC__, __GNUC_MINOR__, and
__GNUC_PATCHLEVEL__ for quick compatibility with code bases that haven't
added compiler specific checks for __clang__ or __INTEL_COMPILER.

This is brittle, as they happened to get compatibility by posing as a
certain version of GCC.  This broke when upgrading the minimal version
of GCC required to build the kernel, to a version above what ICC and
Clang claim to be.

Rather than always including compiler-gcc.h then undefining or
redefining macros in compiler-intel.h or compiler-clang.h, let's
separate out the compiler specific macro definitions into mutually
exclusive headers, do more proper compiler detection, and keep shared
definitions in compiler_types.h.

Fixes: cafa0010

 ("Raise the minimum required gcc version to 4.6")
Reported-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Suggested-by: default avatarEli Friedman <efriedma@codeaurora.org>
Suggested-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 899fbc33
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment