diff options
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0efef9cf014f..cd4bbe8242bd 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -66,18 +66,22 @@ | |||
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Force always-inline if the user requests it so via the .config, | 68 | * Force always-inline if the user requests it so via the .config, |
69 | * or if gcc is too old: | 69 | * or if gcc is too old. |
70 | * GCC does not warn about unused static inline functions for | ||
71 | * -Wunused-function. This turns out to avoid the need for complex #ifdef | ||
72 | * directives. Suppress the warning in clang as well by using "unused" | ||
73 | * function attribute, which is redundant but not harmful for gcc. | ||
70 | */ | 74 | */ |
71 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | 75 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
72 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) | 76 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) |
73 | #define inline inline __attribute__((always_inline)) notrace | 77 | #define inline inline __attribute__((always_inline,unused)) notrace |
74 | #define __inline__ __inline__ __attribute__((always_inline)) notrace | 78 | #define __inline__ __inline__ __attribute__((always_inline,unused)) notrace |
75 | #define __inline __inline __attribute__((always_inline)) notrace | 79 | #define __inline __inline __attribute__((always_inline,unused)) notrace |
76 | #else | 80 | #else |
77 | /* A lot of inline functions can cause havoc with function tracing */ | 81 | /* A lot of inline functions can cause havoc with function tracing */ |
78 | #define inline inline notrace | 82 | #define inline inline __attribute__((unused)) notrace |
79 | #define __inline__ __inline__ notrace | 83 | #define __inline__ __inline__ __attribute__((unused)) notrace |
80 | #define __inline __inline notrace | 84 | #define __inline __inline __attribute__((unused)) notrace |
81 | #endif | 85 | #endif |
82 | 86 | ||
83 | #define __always_inline inline __attribute__((always_inline)) | 87 | #define __always_inline inline __attribute__((always_inline)) |
@@ -223,6 +227,11 @@ | |||
223 | /* Mark a function definition as prohibited from being cloned. */ | 227 | /* Mark a function definition as prohibited from being cloned. */ |
224 | #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) | 228 | #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) |
225 | 229 | ||
230 | #ifdef RANDSTRUCT_PLUGIN | ||
231 | #define __randomize_layout __attribute__((randomize_layout)) | ||
232 | #define __no_randomize_layout __attribute__((no_randomize_layout)) | ||
233 | #endif | ||
234 | |||
226 | #endif /* GCC_VERSION >= 40500 */ | 235 | #endif /* GCC_VERSION >= 40500 */ |
227 | 236 | ||
228 | #if GCC_VERSION >= 40600 | 237 | #if GCC_VERSION >= 40600 |
@@ -294,6 +303,14 @@ | |||
294 | #define __no_sanitize_address __attribute__((no_sanitize_address)) | 303 | #define __no_sanitize_address __attribute__((no_sanitize_address)) |
295 | #endif | 304 | #endif |
296 | 305 | ||
306 | #if GCC_VERSION >= 50100 | ||
307 | /* | ||
308 | * Mark structures as requiring designated initializers. | ||
309 | * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html | ||
310 | */ | ||
311 | #define __designated_init __attribute__((designated_init)) | ||
312 | #endif | ||
313 | |||
297 | #endif /* gcc version >= 40000 specific checks */ | 314 | #endif /* gcc version >= 40000 specific checks */ |
298 | 315 | ||
299 | #if !defined(__noclone) | 316 | #if !defined(__noclone) |