Date: Mon, 22 Apr 2024 19:44:07 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 6290fe776c74 - stable/14 - LinuxKPI: add __counted_by() and __nonstring Message-ID: <202404221944.43MJi73e032477@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6290fe776c74297eb6fd14bee08a31b17a6a54b2 commit 6290fe776c74297eb6fd14bee08a31b17a6a54b2 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2024-04-02 09:41:54 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2024-04-22 17:00:48 +0000 LinuxKPI: add __counted_by() and __nonstring Add checks for __counted_by(_x) and __nonstring as and depending on compiler support enable the attribute/feature. This is needed to make mtk76 and ath1xk drivers compile. Sposnored by: The FreeBSD Foundation Reviewed by: emaste, dim Differential Revision: https://reviews.freebsd.org/D44587 (cherry picked from commit 2a8c50592f7fce8bceedf004f674a5a9eae0fd46) --- sys/compat/linuxkpi/common/include/linux/compiler.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h index 97687ccdc7e1..59c7d3cc04e7 100644 --- a/sys/compat/linuxkpi/common/include/linux/compiler.h +++ b/sys/compat/linuxkpi/common/include/linux/compiler.h @@ -67,6 +67,17 @@ #define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE) #define fallthrough /* FALLTHROUGH */ do { } while(0) +#if __has_attribute(__nonstring__) +#define __nonstring __attribute__((__nonstring__)) +#else +#define __nonstring +#endif +#if __has_attribute(__counted_by__) +#define __counted_by(_x) __attribute__((__counted_by__(_x))) +#else +#define __counted_by(_x) +#endif + #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #define typeof(x) __typeof(x)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404221944.43MJi73e032477>