This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 83680750a33827d0761943378cbffc6f7f31ba5d
Author: v-zhangxiaomeng5 <[email protected]>
AuthorDate: Mon Sep 7 18:22:45 2026 +0800

    compiler.h: define __has_feature/__has_extension/__has_keyword for GCC < 14
    
    GCCs before version 14 lack the Clang feature-query builtins
    __has_feature, __has_extension and __has_keyword, which llvm-21 libcxx
    uses unconditionally. Define them as 0 when absent so the preprocessor
    conditionals evaluate correctly on older GCC. Place them in the GCC
    section next to the existing __has_builtin fallback rather than in the
    libcxx __config_site so the shim lives with the other compiler
    abstractions.
    
    Assisted-by: Claude:claude-opus-5.5
    Signed-off-by: v-zhangxiaomeng5 <[email protected]>
---
 include/nuttx/compiler.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 4ae07992a4b..14325b23f1f 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -1642,6 +1642,18 @@
 #  define __has_include(x) 0
 #endif
 
+#ifndef __has_feature
+#  define __has_feature(x) 0
+#endif
+
+#ifndef __has_extension
+#  define __has_extension(x) 0
+#endif
+
+#ifndef __has_keyword
+#  define __has_keyword(x) 0
+#endif
+
 /* A program can define NUTTX_NO_EXTENSIONS before the first #include to
  * keep some non-standard names free for its own use.  Then the headers do
  * not define ERROR and OK (sys/types.h), set_errno() and get_errno()

Reply via email to