aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/sys/cdefs.h7
-rw-r--r--tools/build/cross-build/include/common/sys/cdefs.h8
2 files changed, 15 insertions, 0 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 3bc4389346d2..ea6a92ad0056 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -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__
diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h
index faad5eccb3af..c7e453394478 100644
--- a/tools/build/cross-build/include/common/sys/cdefs.h
+++ b/tools/build/cross-build/include/common/sys/cdefs.h
@@ -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