[review v2] Fix use of non-existent DIAGNOSTIC_IGNORE_UNUSED_FUNCTION

Luis Machado (Code Review)
2019-12-12T13:03:35Z

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/754
......................................................................

Fix use of non-existent DIAGNOSTIC_IGNORE_UNUSED_FUNCTION

A previous commit removed DIAGNOSTIC_IGNORE_UNUSED_FUNCTION because it is
known not to work correctly for some older versions of GCC.

gdb/ChangeLog:

2019-12-12 Luis Machado <luis.machado@linaro.org>

* gdbsupport/thread-pool.c (set_thread_name): Add ATTRIBUTE_UNUSED
to both functions.
Remove use of DIAGNOSTIC PUSH/POP and DIAGNOSTIC_IGNORE_UNUSED_FUNCTION.

Change-Id: Ifabf1fdb1bbafe55541ae2a93111eef8ec9bf52c
---
M gdb/gdbsupport/thread-pool.c
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/gdb/gdbsupport/thread-pool.c b/gdb/gdbsupport/thread-pool.c
index f6ea6d8..1f96c16 100644
--- a/gdb/gdbsupport/thread-pool.c
+++ b/gdb/gdbsupport/thread-pool.c
@@ -40,27 +40,22 @@

#include <pthread.h>

-DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
-
/* Handle platform discrepancies in pthread_setname_np: macOS uses a
single-argument form, while Linux uses a two-argument form. This
wrapper handles the difference. */

-static void
+ATTRIBUTE_UNUSED static void
set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
{
set_name (pthread_self (), name);
}

-static void
+ATTRIBUTE_UNUSED static void
set_thread_name (void (*set_name) (const char *), const char *name)
{
set_name (name);
}

-DIAGNOSTIC_POP
-
#endif /* USE_PTHREAD_SETNAME_NP */

namespace gdb

--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ifabf1fdb1bbafe55541ae2a93111eef8ec9bf52c
Gerrit-Change-Number: 754
Gerrit-PatchSet: 2
Gerrit-Owner: Luis Machado <luis.machado@linaro.org>
Gerrit-MessageType: newpatchset