mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
cdefs.h: Introduce __nonstring attribute
This attribute can be used to annotate char arrays that are not supposed to be terminated with a NUL char and is needed to silence clang's new -Wunterminated-string-initialization warning. The name matches linuxkpi. Reviewed by: emaste, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D52565
This commit is contained in:
1 parent
ce9557d4ee
commit
802c6d5d61
2 files changed
+15
No files matched your search
@@ -394,6 +394,13 @@
|
||||
#define __printf0like(fmtarg, firstvararg)
|
||||
#endif
|
||||
|
||||
/* To silence warnings about null terminator not fitting into an array. */
|
||||
#if __has_attribute(__nonstring__)
|
||||
#define __nonstring __attribute__((__nonstring__))
|
||||
#else
|
||||
#define __nonstring
|
||||
#endif
|
||||
|
||||
#define __strong_reference(sym,aliassym) \
|
||||
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
|
||||
#ifdef __STDC__
|
||||
|
||||
@@ -100,6 +100,14 @@
|
||||
__attribute__((__format__(__printf0__, fmtarg, firstvararg)))
|
||||
#endif
|
||||
|
||||
#ifndef __nonstring
|
||||
#if __has_attribute(__nonstring__)
|
||||
#define __nonstring __attribute__((__nonstring__))
|
||||
#else
|
||||
#define __nonstring
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __predict_true
|
||||
#define __predict_true(exp) __builtin_expect((exp), 1)
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user