diff options
-rw-r--r-- | include/linux/compiler-clang.h | 12 | ||||
-rw-r--r-- | include/linux/compiler.h | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h new file mode 100644 index 000000000000..d1e49d52b640 --- /dev/null +++ b/include/linux/compiler-clang.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __LINUX_COMPILER_H | ||
2 | #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead." | ||
3 | #endif | ||
4 | |||
5 | /* Some compiler specific definitions are overwritten here | ||
6 | * for Clang compiler | ||
7 | */ | ||
8 | |||
9 | #ifdef uninitialized_var | ||
10 | #undef uninitialized_var | ||
11 | #define uninitialized_var(x) x = *(&(x)) | ||
12 | #endif | ||
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 2472740d7ab2..ee7239ea1583 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -63,6 +63,13 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
63 | # include <linux/compiler-intel.h> | 63 | # include <linux/compiler-intel.h> |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | /* Clang compiler defines __GNUC__. So we will overwrite implementations | ||
67 | * coming from above header files here | ||
68 | */ | ||
69 | #ifdef __clang__ | ||
70 | #include <linux/compiler-clang.h> | ||
71 | #endif | ||
72 | |||
66 | /* | 73 | /* |
67 | * Generic compiler-dependent macros required for kernel | 74 | * Generic compiler-dependent macros required for kernel |
68 | * build go below this comment. Actual compiler/compiler version | 75 | * build go below this comment. Actual compiler/compiler version |