aboutsummaryrefslogtreecommitdiff
path: root/include/ansidecl.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-06-10 09:42:43 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-06-10 07:42:43 +0000
commitde1ee900b045061cdc590fbbf47b46b64d296f04 (patch)
treee8d8028182dfcf97662fa924b29abdf06b8a3c6a /include/ansidecl.h
parent3bb0dcb6c02661bed2f8dd00052145fde3bbdecc (diff)
downloadgcc-de1ee900b045061cdc590fbbf47b46b64d296f04.zip
gcc-de1ee900b045061cdc590fbbf47b46b64d296f04.tar.gz
gcc-de1ee900b045061cdc590fbbf47b46b64d296f04.tar.bz2
Add warn_unused_result attribute for memory-related functions in libiberty.
2019-06-10 Martin Liska <mliska@suse.cz> * ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): New macro. * libiberty.h (xmalloc): Use it. (xrealloc): Likewise. (xcalloc): Likewise. (xstrdup): Likewise. (xstrndup): Likewise. (xmemdup): Likewise. From-SVN: r272110
Diffstat (limited to 'include/ansidecl.h')
-rw-r--r--include/ansidecl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 3035c33..445c8c3 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -317,6 +317,15 @@ So instead we use the macro below and test it against specific values. */
#endif
#endif
+/* Attribute `warn_unused_result' was valid as of gcc 3.3. */
+#ifndef ATTRIBUTE_WARN_UNUSED_RESULT
+# if GCC_VERSION >= 3003
+# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
+# else
+# define ATTRIBUTE_WARN_UNUSED_RESULT
+# 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. */