mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 20:21:05 +01:00
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 MFC after: 3 days Reviewed by: emaste, dim Differential Revision: https://reviews.freebsd.org/D44587
This commit is contained in:
parent
3f115b864b
commit
2a8c50592f
@ -67,6 +67,17 @@
|
|||||||
#define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE)
|
#define ____cacheline_aligned_in_smp __aligned(CACHE_LINE_SIZE)
|
||||||
#define fallthrough /* FALLTHROUGH */ do { } while(0)
|
#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 likely(x) __builtin_expect(!!(x), 1)
|
||||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
#define typeof(x) __typeof(x)
|
#define typeof(x) __typeof(x)
|
||||||
|
Loading…
Reference in New Issue
Block a user