[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] tests: suppress some unwanted -fanalyzer checking
From: |
Bruno Haible |
Subject: |
Re: [PATCH 1/3] tests: suppress some unwanted -fanalyzer checking |
Date: |
Tue, 25 Apr 2023 00:20:36 +0200 |
Paul Eggert wrote:
> * tests/test-dup2.c, tests/test-fcntl.c, tests/test-fopen.h:
> * tests/test-getdtablesize.c, tests/test-listen.c:
> * tests/test-localename.c, tests/test-open.h, tests/test-perror2.c:
> * tests/test-select.h:
> Add pragmas to disable unwanted -fanalyzer checking.
Unfortunately, these pragmas produce warnings with GCC 10, 11, 12.
Find attached the log files.
These are the warnings with gcc 12.2.0:
../../gltests/test-dup2.c:55:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-dup2.c:56:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-fcntl.c:49:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-getdtablesize.c:30:33: warning: unknown option after
‘#pragma GCC diagnostic’ kind [-Wpragmas]
../../gltests/test-listen.c:32:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-open.h:21:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-perror2.c:27:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-select.h:42:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
../../gltests/test-select.h:42:33: warning: unknown option after ‘#pragma GCC
diagnostic’ kind [-Wpragmas]
And with gcc 11.3.0 and 10.4.0 there's also this one:
../../gltests/test-localename.c:40:33: warning: unknown option after ‘#pragma
GCC diagnostic’ kind [-Wpragmas]
This patch fixes them.
Now, since it's not possible to silence these diagnostics with GCC 10, 11, 12,
if you don't want them to be present, I guess you'll need to touch the
'manywarnings' module, to not enable them in these releases of GCC, i.e. only
enable them for GCC >= 13?
2023-04-24 Bruno Haible <bruno@clisp.org>
tests: Suppress ‘#pragma GCC diagnostic’ warnings with GCC < 13.
* tests/test-localename.c: Disable #pragma for GCC < 12.
* tests/test-dup2.c: Disable #pragma for GCC < 13.
* tests/test-fcntl.c: Likewise.
* tests/test-getdtablesize.c: Likewise.
* tests/test-listen.c: Likewise.
* tests/test-open.h: Likewise.
* tests/test-perror2.c: Likewise.
* tests/test-select.h: Likewise.
diff --git a/tests/test-dup2.c b/tests/test-dup2.c
index e7957271ad..8acbc038ca 100644
--- a/tests/test-dup2.c
+++ b/tests/test-dup2.c
@@ -51,7 +51,7 @@ SIGNATURE_CHECK (dup2, int, (int, int));
#include "macros.h"
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
#endif
diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c
index c2b7377b59..5fb554afe7 100644
--- a/tests/test-fcntl.c
+++ b/tests/test-fcntl.c
@@ -45,10 +45,8 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...));
#include "macros.h"
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
-# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
-#endif
#if __GNUC__ >= 13
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
# pragma GCC diagnostic ignored "-Wanalyzer-va-arg-type-mismatch"
#endif
diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c
index 4eb28d9b1e..d2c93f19a4 100644
--- a/tests/test-getdtablesize.c
+++ b/tests/test-getdtablesize.c
@@ -26,7 +26,7 @@ SIGNATURE_CHECK (getdtablesize, int, (void));
#include "macros.h"
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
#endif
diff --git a/tests/test-listen.c b/tests/test-listen.c
index b245e48f3a..8d85779bfc 100644
--- a/tests/test-listen.c
+++ b/tests/test-listen.c
@@ -28,7 +28,7 @@ SIGNATURE_CHECK (listen, int, (int, int));
#include "macros.h"
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
#endif
diff --git a/tests/test-localename.c b/tests/test-localename.c
index 090afeb538..6d97efb050 100644
--- a/tests/test-localename.c
+++ b/tests/test-localename.c
@@ -36,7 +36,7 @@
#endif
/* Suppress GCC false positive. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 12
# pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
#endif
diff --git a/tests/test-open.h b/tests/test-open.h
index f01523dc16..d3af8215d0 100644
--- a/tests/test-open.h
+++ b/tests/test-open.h
@@ -17,7 +17,7 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
#endif
diff --git a/tests/test-perror2.c b/tests/test-perror2.c
index 0c96832d37..25390ff533 100644
--- a/tests/test-perror2.c
+++ b/tests/test-perror2.c
@@ -23,7 +23,7 @@
#include <unistd.h>
/* Tell GCC not to warn about myerr being leaked. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
#endif
diff --git a/tests/test-select.h b/tests/test-select.h
index af840d2bc8..902e085bcd 100644
--- a/tests/test-select.h
+++ b/tests/test-select.h
@@ -38,7 +38,7 @@
#endif
/* Tell GCC not to warn about the specific edge cases tested here. */
-#if __GNUC__ >= 10
+#if __GNUC__ >= 13
# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
#endif
gcc10-build.log
Description: Text Data
gcc11-build.log
Description: Text Data
gcc12-build.log
Description: Text Data