]> Savannah Git Hosting - gnulib.git/commitdiff
unsetenv-tests: pacify -Wanalyzer-putenv-of-auto-var
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2023 19:06:54 +0000 (12:06 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2023 19:07:40 +0000 (12:07 -0700)
* tests/test-unsetenv.c (main): Make entry static.  Even with this
change, it’s unclear whether this test is portable POSIX code, but
that’s a different matter.

ChangeLog
tests/test-unsetenv.c

index 5a082f25378df8c8ae6113564d62c621f508b5fa..972aec03db05ba25ee434ea8eb9b589a35cf0dcd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-04-24  Paul Eggert  <eggert@cs.ucla.edu>
 
+       unsetenv-tests: pacify -Wanalyzer-putenv-of-auto-var
+       * tests/test-unsetenv.c (main): Make entry static.  Even with this
+       change, it’s unclear whether this test is portable POSIX code, but
+       that’s a different matter.
+
        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:
index ddc412867fcb9b206c2e09efc006dc2010be009a..d8e5b0119209a3192a70f6e2c1970972b4b5effb 100644 (file)
@@ -32,7 +32,8 @@ SIGNATURE_CHECK (unsetenv, int, (char const *));
 int
 main (void)
 {
-  char entry[] = "b=2";
+  /* Static to pacify gcc -Wanalyzer-putenv-of-auto-var.  */
+  static char entry[] = "b=2";
 
   /* Test removal when multiple entries present.  */
   ASSERT (putenv ((char *) "a=1") == 0);