Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2024 21:10:56 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 677b28750a86 - main - sys/cdefs.h: Note gcc supports many __has_* macros
Message-ID:  <202406242110.45OLAuAR045421@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=677b28750a86a63d2e94d1187166fe5ccf0e1813

commit 677b28750a86a63d2e94d1187166fe5ccf0e1813
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-06-24 19:20:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-24 21:11:05 +0000

    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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406242110.45OLAuAR045421>