lkml.org 
[lkml]   [2022]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH linux-next] tools: compiler-gcc.h: Keep compatible with older GCC versions
Date
From: xu xin <xu.xin16@zte.com.cn>

When HOST CC = gcc (GCC) 4.8.5, we found that there is an error occurring:
Undefined __has_attribute as we built the whole kernel and tools.

To solve this, this patch is given to keep the compatibility with older
GCC versions.

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 | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
index 8816f06fc6c7..333ed16b3b12 100644
--- a/tools/include/linux/compiler-gcc.h
+++ b/tools/include/linux/compiler-gcc.h
@@ -16,6 +16,10 @@
# define __fallthrough __attribute__ ((fallthrough))
#endif

+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with GCC versions < 5.x */
+#endif
+
#if __has_attribute(__error__)
# define __compiletime_error(message) __attribute__((error(message)))
#endif
--
2.25.1
\
 
 \ /
  Last update: 2022-01-02 13:03    [W:0.038 / U:1.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site