This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
ATTRIBUTE_NONSTRING
- From: Alan Modra <amodra at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: DJ Delorie <dj at redhat dot com>, Ian Lance Taylor <ian at airs dot com>
- Date: Fri, 27 Apr 2018 11:11:26 +0930
- Subject: ATTRIBUTE_NONSTRING
This patch adds ATTRIBUTE_NONSTRING, which will be used to curb
-Wstringop-truncation warnings in binutils. OK to apply?
* ansidecl.h (ATTRIBUTE_NONSTRING): Define.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index c11daff..ec5f34d 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -283,6 +283,15 @@ So instead we use the macro below and test it against specific values. */
# endif /* GNUC >= 4.9 */
#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
+/* Attribute 'nonstring' was valid as of gcc 8. */
+#ifndef ATTRIBUTE_NONSTRING
+# if GCC_VERSION >= 8000
+# define ATTRIBUTE_NONSTRING __attribute__ ((nonstring))
+# else
+# define ATTRIBUTE_NONSTRING
+# endif
+#endif
+
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
--
Alan Modra
Australia Development Lab, IBM