From 3a80792278be69b9270485b07a79a62a5978c4bf Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 21 Nov 2024 08:24:35 +0100 Subject: [PATCH] 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. --- helgrind/hg_intercepts.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 43afd89f4..ac2449e60 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; } -- 2.47.2