From 677b28750a86a63d2e94d1187166fe5ccf0e1813 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 24 Jun 2024 13:20:57 -0600 Subject: [PATCH] sys/cdefs.h: Note gcc supports many __has_* macros The __has_* macros are no longer clang-speicifc. gcc 5 introduced __has_include, gcc 9 introduce __has_attribute, gcc 10 introduced __has_builtin. So all of these are supported by all the versrions of gcc we support as a project (we have gcc 10 and newer ports, but no older ones), so just refer to them as supported by gcc. The exact version doesn't matter so much these days (we provide a fallback for older compilers still, should anybody still be using them), so don't mention them in the comments (but here in the commit message they are discoverable). gcc 14 adds __has_feature and __has_extension, so note that since it will be relevant for many years. Sponsored by: Netflix --- sys/sys/cdefs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 32050ef81848..58146ddc721c 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -40,7 +40,10 @@ #endif /* - * Testing against Clang-specific extensions. + * Provide clang-compatible testing macros. All supported versions of gcc (10+) + * provide all of these except has_feature and has_extension which are new in + * gcc 14. Keep the older ifndefs, though, for non-gcc compilers that may lack + * them like tcc and pcc. */ #ifndef __has_attribute #define __has_attribute(x) 0