[PATCH 3/7] Compiler Attributes: remove unneeded tests

From: Miguel Ojeda
Date: Fri Aug 31 2018 - 13:05:30 EST


Attributes const and always_inline have tests around them
which are unneeded, since they are supported by gcc >= 4.6,
clang >= 3 and icc >= 13. See https://godbolt.org/z/no0OZH

In the case of gnu_inline, we do not need to test for
__GNUC_STDC_INLINE__ because, regardless of the current
inlining behavior, we can simply always force the old
GCC inlining behavior by using the attribute in all cases.

Cc: Eli Friedman <efriedma@xxxxxxxxxxxxxx>
Cc: Christopher Li <sparse@xxxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Cc: Joe Perches <joe@xxxxxxxxxxx>
Cc: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx>
---
include/linux/compiler_types.h | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 7cd958360ead..3662b19599fc 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -158,10 +158,6 @@ struct ftrace_likely_data {
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))

-#ifndef __attribute_const__
-#define __attribute_const__ __attribute__((const))
-#endif
-
#ifndef __noclone
#define __noclone
#endif
@@ -196,6 +192,7 @@ struct ftrace_likely_data {
* [...]
*/
#define __pure __attribute__((pure))
+#define __const __attribute__((const))
#define __aligned(x) __attribute__((aligned(x)))
#define __aligned_largest __attribute__((aligned))
#define __printf(a, b) __attribute__((format(printf, a, b)))
@@ -227,17 +224,7 @@ struct ftrace_likely_data {

#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)

-/*
- * Feature detection for gnu_inline (gnu89 extern inline semantics). Either
- * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
- * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
- * defined so the gnu89 semantics are the default.
- */
-#ifdef __GNUC_STDC_INLINE__
-# define __gnu_inline __attribute__((gnu_inline))
-#else
-# define __gnu_inline
-#endif
+#define __gnu_inline __attribute__((gnu_inline))

/*
* Force always-inline if the user requests it so via the .config.
@@ -263,9 +250,7 @@ struct ftrace_likely_data {
#define __inline inline
#define noinline __attribute__((noinline))

-#ifndef __always_inline
#define __always_inline inline __attribute__((always_inline))
-#endif

/*
* Rather then using noinline to prevent stack consumption, use
--
2.17.1