diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 04:08:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 04:08:09 -0400 |
commit | d2fc88a61b4ea99f574bde16e92718e22f312136 (patch) | |
tree | f256841ebcbc3b90fc29d7fa751610ba9aac5a2b /include/linux/compiler-gcc.h | |
parent | e16f4f3e0b7daecd48d4f944ab4147c1a6cb16a8 (diff) | |
parent | acb1872577b346bd15ab3a3f8dff780d6cca4b70 (diff) |
Merge 4.18-rc7 into driver-core-next
We need the driver core changes in here as well for testing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r-- | include/linux/compiler-gcc.h | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index f1a7492a5cc8..573f5a7d42d4 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -66,25 +66,40 @@ | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Feature detection for gnu_inline (gnu89 extern inline semantics). Either | ||
70 | * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics, | ||
71 | * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not | ||
72 | * defined so the gnu89 semantics are the default. | ||
73 | */ | ||
74 | #ifdef __GNUC_STDC_INLINE__ | ||
75 | # define __gnu_inline __attribute__((gnu_inline)) | ||
76 | #else | ||
77 | # define __gnu_inline | ||
78 | #endif | ||
79 | |||
80 | /* | ||
69 | * Force always-inline if the user requests it so via the .config, | 81 | * Force always-inline if the user requests it so via the .config, |
70 | * or if gcc is too old. | 82 | * or if gcc is too old. |
71 | * GCC does not warn about unused static inline functions for | 83 | * GCC does not warn about unused static inline functions for |
72 | * -Wunused-function. This turns out to avoid the need for complex #ifdef | 84 | * -Wunused-function. This turns out to avoid the need for complex #ifdef |
73 | * directives. Suppress the warning in clang as well by using "unused" | 85 | * directives. Suppress the warning in clang as well by using "unused" |
74 | * function attribute, which is redundant but not harmful for gcc. | 86 | * function attribute, which is redundant but not harmful for gcc. |
87 | * Prefer gnu_inline, so that extern inline functions do not emit an | ||
88 | * externally visible function. This makes extern inline behave as per gnu89 | ||
89 | * semantics rather than c99. This prevents multiple symbol definition errors | ||
90 | * of extern inline functions at link time. | ||
91 | * A lot of inline functions can cause havoc with function tracing. | ||
75 | */ | 92 | */ |
76 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | 93 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
77 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) | 94 | !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) |
78 | #define inline inline __attribute__((always_inline,unused)) notrace | 95 | #define inline \ |
79 | #define __inline__ __inline__ __attribute__((always_inline,unused)) notrace | 96 | inline __attribute__((always_inline, unused)) notrace __gnu_inline |
80 | #define __inline __inline __attribute__((always_inline,unused)) notrace | ||
81 | #else | 97 | #else |
82 | /* A lot of inline functions can cause havoc with function tracing */ | 98 | #define inline inline __attribute__((unused)) notrace __gnu_inline |
83 | #define inline inline __attribute__((unused)) notrace | ||
84 | #define __inline__ __inline__ __attribute__((unused)) notrace | ||
85 | #define __inline __inline __attribute__((unused)) notrace | ||
86 | #endif | 99 | #endif |
87 | 100 | ||
101 | #define __inline__ inline | ||
102 | #define __inline inline | ||
88 | #define __always_inline inline __attribute__((always_inline)) | 103 | #define __always_inline inline __attribute__((always_inline)) |
89 | #define noinline __attribute__((noinline)) | 104 | #define noinline __attribute__((noinline)) |
90 | 105 | ||
@@ -347,3 +362,28 @@ | |||
347 | #if GCC_VERSION >= 50100 | 362 | #if GCC_VERSION >= 50100 |
348 | #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 | 363 | #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 |
349 | #endif | 364 | #endif |
365 | |||
366 | /* | ||
367 | * Turn individual warnings and errors on and off locally, depending | ||
368 | * on version. | ||
369 | */ | ||
370 | #define __diag_GCC(version, severity, s) \ | ||
371 | __diag_GCC_ ## version(__diag_GCC_ ## severity s) | ||
372 | |||
373 | /* Severity used in pragma directives */ | ||
374 | #define __diag_GCC_ignore ignored | ||
375 | #define __diag_GCC_warn warning | ||
376 | #define __diag_GCC_error error | ||
377 | |||
378 | /* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ | ||
379 | #if GCC_VERSION >= 40600 | ||
380 | #define __diag_str1(s) #s | ||
381 | #define __diag_str(s) __diag_str1(s) | ||
382 | #define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) | ||
383 | #endif | ||
384 | |||
385 | #if GCC_VERSION >= 80000 | ||
386 | #define __diag_GCC_8(s) __diag(s) | ||
387 | #else | ||
388 | #define __diag_GCC_8(s) | ||
389 | #endif | ||