]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Helgrind: fix unused result of write warnings
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 21 Nov 2024 07:24:35 +0000 (08:24 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 21 Nov 2024 07:24:35 +0000 (08:24 +0100)
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

index 43afd89f47c0d84c9c0aa54d78a4f0c73dec1d6c..ac2449e609cb15bed41af697c9a9682625c25e07 100644 (file)
@@ -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;
 }