diff options
Diffstat (limited to 'include/linux/compiler-clang.h')
-rw-r--r-- | include/linux/compiler-clang.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 7d98e263e048..7087446c24c8 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h | |||
@@ -32,3 +32,17 @@ | |||
32 | #ifdef __noretpoline | 32 | #ifdef __noretpoline |
33 | #undef __noretpoline | 33 | #undef __noretpoline |
34 | #endif | 34 | #endif |
35 | |||
36 | /* | ||
37 | * Not all versions of clang implement the the type-generic versions | ||
38 | * of the builtin overflow checkers. Fortunately, clang implements | ||
39 | * __has_builtin allowing us to avoid awkward version | ||
40 | * checks. Unfortunately, we don't know which version of gcc clang | ||
41 | * pretends to be, so the macro may or may not be defined. | ||
42 | */ | ||
43 | #undef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW | ||
44 | #if __has_builtin(__builtin_mul_overflow) && \ | ||
45 | __has_builtin(__builtin_add_overflow) && \ | ||
46 | __has_builtin(__builtin_sub_overflow) | ||
47 | #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 | ||
48 | #endif | ||