public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH linux-next] tools: compiler-gcc.h::Keep compatible with non-clang compilers.
@ 2021-12-31 10:08 cgel.zte
  2021-12-31 16:54 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-12-31 10:08 UTC (permalink / raw)
  To: nathan, ndesaulniers, keescook
  Cc: wang.yong12, xu.xin16, linux-kernel, llvm, Zeal Robot

From: xu xin <xu.xin16@zte.com.cn>

When HOSTC = gcc (GCC) 4.8.5, there is an error occurring as follows:
error: Undefined __has_attribute.

This problem is introduced by commit d0ee23f9d78be ("tools:
compiler-gcc.h: Guard error attribute use with __has_attribute").

To solve it, this patch is given to keep the comatibility.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Co-developed-by: wangyong <wang.yong12@zte.com.cn>
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
---
 tools/include/linux/compiler-gcc.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
index 8816f06fc6c7..7da593d3cb91 100644
--- a/tools/include/linux/compiler-gcc.h
+++ b/tools/include/linux/compiler-gcc.h
@@ -16,6 +16,11 @@
 # define __fallthrough __attribute__ ((fallthrough))
 #endif
 
+
+#ifndef __has_attribute
+# define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */
+#endif
+
 #if __has_attribute(__error__)
 # define __compiletime_error(message) __attribute__((error(message)))
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-31 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-31 10:08 [PATCH linux-next] tools: compiler-gcc.h::Keep compatible with non-clang compilers cgel.zte
2021-12-31 16:54 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox