From: Paul F. <pa...@so...> - 2024-11-21 07:34:44
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3a80792278be69b9270485b07a79a62a5978c4bf commit 3a80792278be69b9270485b07a79a62a5978c4bf Author: Paul Floyd <pj...@wa...> Date: Thu Nov 21 08:24:35 2024 +0100 Helgrind: fix unused result of write warnings Thanks to GCC deciding that we can't ignore wur annotated functions by casting to void we need to do otherwise. It was either pragmas or adding an annotated unused local. Pragmas seem to be the least awful. Diff: --- helgrind/hg_intercepts.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 43afd89f47..ac2449e609 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -978,7 +978,10 @@ static int mutex_lock_WRK(pthread_mutex_t *mutex) if (TRACE_PTH_FNS) { char buf[30]; snprintf(buf, 30, "<< pthread_mxlock %p", mutex); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" write(STDERR_FILENO, buf, strlen(buf)); +#pragma GCC diagnostic pop fsync(STDERR_FILENO); } @@ -1014,7 +1017,10 @@ HG_MUTEX_LOCK_OUT: if (TRACE_PTH_FNS) { char buf[30]; snprintf(buf, 30, " :: mxlock -> %d >>\n", ret); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result"1251 write(STDERR_FILENO, buf, strlen(buf)); +#pragma GCC diagnostic pop } return ret; } @@ -1242,7 +1248,10 @@ static int mutex_unlock_WRK(pthread_mutex_t *mutex) if (TRACE_PTH_FNS) { char buf[30]; snprintf(buf, 30, "<< pthread_mxunlk %p", mutex); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" write(STDERR_FILENO, buf, strlen(buf)); +#pragma GCC diagnostic pop fsync(STDERR_FILENO); } @@ -1261,7 +1270,10 @@ static int mutex_unlock_WRK(pthread_mutex_t *mutex) if (TRACE_PTH_FNS) { char buf[30]; snprintf(buf, 30, " :: mxunlk -> %d >>\n", ret); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" write(STDERR_FILENO, buf, strlen(buf)); +#pragma GCC diagnostic pop } return ret; } |