Introduce ATTRIBUTE_UNUSED_RESULT and use it
authorTom Tromey <tromey@adacore.com>
Tue, 26 Feb 2019 21:39:01 +0000 (14:39 -0700)
committerTom Tromey <tromey@adacore.com>
Tue, 5 Mar 2019 15:48:39 +0000 (08:48 -0700)
This introduces the new ATTRIBUTE_UNUSED_RESULT define, and applies it
to gdb_argv::release.

gdb/ChangeLog
2019-03-05  Tom Tromey  <tromey@adacore.com>

* utils.h (class gdb_argv) <release>: Add
ATTRIBUTE_UNUSED_RESULT.
* common/common-defs.h (ATTRIBUTE_UNUSED_RESULT): Define.

gdb/ChangeLog
gdb/common/common-defs.h
gdb/utils.h

index 65a74cd0266c32ff64698532a1a0d465ecdc2e48..fae7ec0a8043d190b5c94efa931468645a81243a 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-05  Tom Tromey  <tromey@adacore.com>
+
+       * utils.h (class gdb_argv) <release>: Add
+       ATTRIBUTE_UNUSED_RESULT.
+       * common/common-defs.h (ATTRIBUTE_UNUSED_RESULT): Define.
+
 2019-03-02  Eli Zaretskii  <eliz@gnu.org>
 
        * xml-syscall.c (xml_list_syscalls_by_group): Drop 'struct' from
index 732693d65cc6ef8090c3837ec36898c879363f45..6b1f004ab1bd97f4fdbc4e3814e4a4d89c382f7b 100644 (file)
 #undef ATTRIBUTE_PRINTF
 #define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
 
+#if GCC_VERSION >= 3004
+#define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
+#else
+#define ATTRIBUTE_UNUSED_RESULT
+#endif
+
 #include "libiberty.h"
 #include "pathmax.h"
 #include "gdb/signals.h"
index 896feb973c99c84870685ded30af47fc445b9951..9dbd6386c68f3ccb51e3339b9a1e0ca4bc104aca 100644 (file)
@@ -188,7 +188,7 @@ public:
   /* Return the underlying array, transferring ownership to the
      caller.  */
 
-  char **release ()
+  ATTRIBUTE_UNUSED_RESULT char **release ()
   {
     char **result = m_argv;
     m_argv = NULL;