From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
Eli Friedman <efriedma@codeaurora.org>,
Christopher Li <sparse@chrisli.org>,
Kees Cook <keescook@chromium.org>, Ingo Molnar <mingo@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Joe Perches <joe@perches.com>,
Dominique Martinet <asmadeus@codewreck.org>,
linux-sparse@vger.kernel.org
Subject: [PATCH 03/12] Compiler Attributes: remove unneeded tests
Date: Mon, 3 Sep 2018 22:33:07 +0200 [thread overview]
Message-ID: <20180903203316.16183-4-miguel.ojeda.sandonis@gmail.com> (raw)
In-Reply-To: <20180903203316.16183-1-miguel.ojeda.sandonis@gmail.com>
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. https://godbolt.org/z/DFPq37
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: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Eli Friedman <efriedma@codeaurora.org>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Joe Perches <joe@perches.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-sparse@vger.kernel.org
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
include/linux/compiler_types.h | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 2bc0f94df38e..759b3fea9216 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 __attribute_const__ __attribute__((__const__))
#define __aligned(x) __attribute__((__aligned__(x)))
#define __aligned_largest __attribute__((__aligned__))
#define __printf(a, b) __attribute__((__format__(printf, a, b)))
@@ -211,7 +208,8 @@ struct ftrace_likely_data {
#define __alias(symbol) __attribute__((__alias__(#symbol)))
#define __cold __attribute__((__cold__))
#define __section(S) __attribute__((__section__(#S)))
-
+#define __gnu_inline __attribute__((__gnu_inline__))
+#define __always_inline inline __attribute__((__always_inline__))
#ifdef CONFIG_ENABLE_MUST_CHECK
#define __must_check __attribute__((__warn_unused_result__))
@@ -227,18 +225,6 @@ 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
-
/*
* Force always-inline if the user requests it so via the .config.
* GCC does not warn about unused static inline functions for
@@ -263,10 +249,6 @@ 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
* noinline_for_stack instead. For documentation reasons.
--
2.17.1
next prev parent reply other threads:[~2018-09-03 20:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-03 20:33 [PATCH v3 00/12] Compiler Attributes Miguel Ojeda
2018-09-03 20:33 ` [PATCH 01/12] Compiler Attributes: remove unused attributes Miguel Ojeda
2018-09-03 20:33 ` [PATCH 02/12] Compiler Attributes: always use the extra-underscores syntax Miguel Ojeda
2018-09-03 20:33 ` Miguel Ojeda [this message]
2018-09-03 20:33 ` [PATCH 04/12] Compiler Attributes: homogenize __must_be_array Miguel Ojeda
2018-09-03 20:33 ` [PATCH 05/12] Compiler Attributes: naked was fixed in gcc 4.6 Miguel Ojeda
2018-09-03 20:33 ` [PATCH 06/12] Compiler Attributes: naked can be shared Miguel Ojeda
2018-09-03 20:33 ` [PATCH 07/12] Compiler Attributes: remove unneeded sparse (__CHECKER__) tests Miguel Ojeda
2018-09-05 18:20 ` Luc Van Oostenryck
2018-09-05 19:30 ` Josh Triplett
2018-09-05 19:40 ` Linus Torvalds
2018-09-05 19:49 ` Luc Van Oostenryck
2018-09-03 20:33 ` [PATCH 08/12] Compiler Attributes: add missing SPDX ID in compiler_types.h Miguel Ojeda
2018-09-03 20:33 ` [PATCH 09/12] Compiler Attributes: use feature checks instead of version checks Miguel Ojeda
2018-09-03 20:33 ` [PATCH 10/12] Compiler Attributes: KENTRY used twice the "used" attribute Miguel Ojeda
2018-09-04 16:58 ` Nick Desaulniers
2018-09-03 20:33 ` [PATCH 11/12] Compiler Attributes: remove uses of __attribute__ from compiler.h Miguel Ojeda
2018-09-03 20:33 ` [PATCH 12/12] Compiler Attributes: add Doc/process/programming-language.rst Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180903203316.16183-4-miguel.ojeda.sandonis@gmail.com \
--to=miguel.ojeda.sandonis@gmail.com \
--cc=arnd@arndb.de \
--cc=asmadeus@codewreck.org \
--cc=efriedma@codeaurora.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=luc.vanoostenryck@gmail.com \
--cc=mingo@kernel.org \
--cc=sparse@chrisli.org \
--cc=torvalds@linux-foundation.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).