[compiler] GCC 14.1 supports __has_feature

Enable it if not present, not just if its clang.
This commit is contained in:
Travis Geiselbrecht
2024-05-09 18:50:44 -07:00
parent ac5cd774a6
commit 6a3db09e55
2 changed files with 16 additions and 20 deletions

View File

@@ -56,25 +56,6 @@
#define __BEGIN_DECLS __BEGIN_CDECLS
#define __END_DECLS __END_CDECLS
/*
* Testing against Clang-specific extensions.
*/
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef __has_extension
#define __has_extension __has_feature
#endif
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef __has_include
#define __has_include(x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
/*-
* Deal with _ANSI_SOURCE:
* If it is defined, and no other compilation environment is explicitly

View File

@@ -138,11 +138,26 @@
#define __FALLTHROUGH do {} while (0)
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef __has_extension
#define __has_extension __has_feature
#endif
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#ifndef __has_include
#define __has_include(x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#ifndef __clang__
#define __LEAF_FN __attribute__((__leaf__))
#define __OPTIMIZE(x) __attribute__((optimize(x)))
#define __THREAD_ANNOTATION(x)
#define __has_feature(x) 0
#else
#define __LEAF_FN
#define __OPTIMIZE(x)