summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-04-24 12:06:54 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2023-04-24 12:07:39 -0700
commit9e6a37ccc2964c63ebc8491ad0da4d6ac668f2b4 (patch)
tree763581e166fa6d32f3d5998114ef5d2d48674d18
parentc254399aae1fb663ff9d3038aa4725213afc2cc3 (diff)
downloadgnulib-9e6a37ccc2964c63ebc8491ad0da4d6ac668f2b4.tar.gz
tests: suppress some unwanted -fanalyzer checking
* 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.
-rw-r--r--ChangeLog9
-rw-r--r--tests/test-dup2.c6
-rw-r--r--tests/test-fcntl.c8
-rw-r--r--tests/test-fopen.h5
-rw-r--r--tests/test-getdtablesize.c5
-rw-r--r--tests/test-listen.c5
-rw-r--r--tests/test-localename.c4
-rw-r--r--tests/test-open.h5
-rw-r--r--tests/test-perror2.c5
-rw-r--r--tests/test-select.h4
10 files changed, 56 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0420fa8c9e..5a082f2537 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ tests: suppress some unwanted -fanalyzer checking
+ * 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.
+
2023-04-24 Bruno Haible <bruno@clisp.org>
ftell, ftello: Fix recognition of pipes on native Windows.
diff --git a/tests/test-dup2.c b/tests/test-dup2.c
index 85133ea1e4..e7957271ad 100644
--- a/tests/test-dup2.c
+++ b/tests/test-dup2.c
@@ -50,6 +50,12 @@ SIGNATURE_CHECK (dup2, 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"
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
+
/* Return non-zero if FD is open. */
static int
is_open (int fd)
diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c
index 4206de991a..c2b7377b59 100644
--- a/tests/test-fcntl.c
+++ b/tests/test-fcntl.c
@@ -44,6 +44,14 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...));
#include "binary-io.h"
#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-va-arg-type-mismatch"
+#endif
+
#if !O_BINARY
# define set_binary_mode(f,m) zero ()
static int zero (void) { return 0; }
diff --git a/tests/test-fopen.h b/tests/test-fopen.h
index a03c931816..751afd8c61 100644
--- a/tests/test-fopen.h
+++ b/tests/test-fopen.h
@@ -23,6 +23,11 @@
#include "macros.h"
+/* Tell GCC not to warn about the specific edge cases tested here. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
+#endif
+
/* Test fopen. Assumes BASE is defined. */
static int
diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c
index 46a546fead..4eb28d9b1e 100644
--- a/tests/test-getdtablesize.c
+++ b/tests/test-getdtablesize.c
@@ -25,6 +25,11 @@ SIGNATURE_CHECK (getdtablesize, int, (void));
#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
+
int
main (int argc, char *argv[])
{
diff --git a/tests/test-listen.c b/tests/test-listen.c
index 43b86a8bb0..b245e48f3a 100644
--- a/tests/test-listen.c
+++ b/tests/test-listen.c
@@ -27,6 +27,11 @@ SIGNATURE_CHECK (listen, int, (int, int));
#include "sockets.h"
#include "macros.h"
+/* Tell GCC not to warn about the specific edge cases tested here. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
+
int
main (void)
{
diff --git a/tests/test-localename.c b/tests/test-localename.c
index d56d14ed0a..090afeb538 100644
--- a/tests/test-localename.c
+++ b/tests/test-localename.c
@@ -35,6 +35,10 @@
# define freelocale(loc) ((void) (loc))
#endif
+/* Suppress GCC false positive. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
+#endif
#if HAVE_GOOD_USELOCALE
diff --git a/tests/test-open.h b/tests/test-open.h
index 18549c4c4f..f01523dc16 100644
--- a/tests/test-open.h
+++ b/tests/test-open.h
@@ -16,6 +16,11 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+/* Tell GCC not to warn about the specific edge cases tested here. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
/* Make test_open always inline if we're using Fortify, which defines
__always_inline to do that. Do nothing otherwise. This works
around a glibc bug whereby 'open' cannot be used as a function
diff --git a/tests/test-perror2.c b/tests/test-perror2.c
index de12480322..0c96832d37 100644
--- a/tests/test-perror2.c
+++ b/tests/test-perror2.c
@@ -22,6 +22,11 @@
#include <string.h>
#include <unistd.h>
+/* Tell GCC not to warn about myerr being leaked. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak"
+#endif
+
/* This test intentionally parses stderr. So, we arrange to have fd 10
(outside the range of interesting fd's during the test) set up to
duplicate the original stderr. */
diff --git a/tests/test-select.h b/tests/test-select.h
index ceeb485471..af840d2bc8 100644
--- a/tests/test-select.h
+++ b/tests/test-select.h
@@ -37,6 +37,10 @@
# include <sys/wait.h>
#endif
+/* Tell GCC not to warn about the specific edge cases tested here. */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic ignored "-Wanalyzer-fd-use-without-check"
+#endif
typedef int (*select_fn) (int, fd_set *, fd_set *, fd_set *, struct timeval *);