[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181128140852.178260-1-liuxiaozhou@bytedance.com>
Date: Wed, 28 Nov 2018 22:08:50 +0800
From: Xiaozhou Liu <liuxiaozhou@...edance.com>
To: "ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Paul Burton <paul.burton@...s.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Cc: Xiaozhou Liu <liuxiaozhou@...edance.com>
Subject: [PATCH] Compiler Attributes: move kernel-only attributes into __KERNEL__
Attributes such as `__gnu_inline' are meant to be used within the
kernel. When userspace somehow includes <linux/compiler.h>
(eg. tools/bpf), compilation errors would be shown:
"error: unknown type name ‘__gnu_inline’"
So just move these things into __KERNEL__ and the behavior is kept
as before.
Fixes: a3f8a30f3f00 ("Compiler Attributes: use feature checks instead of version checks")
Signed-off-by: Xiaozhou Liu <liuxiaozhou@...edance.com>
---
include/linux/compiler_types.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 4a3f9c09c92d..2fb2c311e5d6 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -161,6 +161,8 @@ struct ftrace_likely_data {
#define __diag_error(compiler, version, option, comment) \
__diag_ ## compiler(version, error, option)
+#ifdef __KERNEL__
+
#ifdef CONFIG_ENABLE_MUST_CHECK
#define __must_check __attribute__((__warn_unused_result__))
#else
@@ -215,4 +217,6 @@ struct ftrace_likely_data {
*/
#define noinline_for_stack noinline
+#endif /* __KERNEL__ */
+
#endif /* __LINUX_COMPILER_TYPES_H */
--
2.11.0
Powered by blists - more mailing lists