* 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             | 5 +++++
 tests/test-unsetenv.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 5a082f2537..972aec03db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-04-24  Paul Eggert  <egg...@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:
diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c
index ddc412867f..d8e5b01192 100644
--- a/tests/test-unsetenv.c
+++ b/tests/test-unsetenv.c
@@ -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);
-- 
2.40.0


Reply via email to