summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Haehnel <marcus.haehnel@kernkonzept.com>2024-07-09 10:05:31 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2024-07-09 14:04:49 +0200
commit057913bc8cd35582ab3dcf7ccb08989f24fe3352 (patch)
treecd4bbe61abcbc4ac2cd9c5b86ae76231ea0219a3
parent9827836ce5c6cf648a37202f7d5eb73af1667466 (diff)
features.h: add clang prerequisite macro
This can be used to guard features for specific clang versions. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
-rw-r--r--include/features.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/features.h b/include/features.h
index b5d4e79f2..1a4efb9db 100644
--- a/include/features.h
+++ b/include/features.h
@@ -140,6 +140,18 @@
# define __GNUC_PREREQ(maj, min) 0
#endif
+/* Convenience macro to test the version of clang.
+ Use like this:
+ #if __CLANG_PREREQ(3,2)
+ ... code requiring clang 3.2 or later ...
+ #endif */
+#if defined __clang__
+# define __CLANG_PREREQ(maj, min) \
+ ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
+#else
+# define __CLANG_PREREQ(maj, min) 0
+#endif
+
/* Whether to use feature set F. */
#define __GLIBC_USE(F) __GLIBC_USE_ ## F