From: Paul Eggert Date: Fri, 17 May 2024 05:40:59 +0000 (-0700) Subject: putenv-tests: pacify gcc -Wdiscarded-qualifiers X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=15cd8edb6ec9aed2585e10456d46eec09d5c1b8b;p=gnulib.git putenv-tests: pacify gcc -Wdiscarded-qualifiers * tests/test-putenv.c (main): Don’t pass a string literal to a function expecting ‘char *’. --- diff --git a/ChangeLog b/ChangeLog index a8ed30c4ae..5238067cf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-05-16 Paul Eggert + putenv-tests: pacify gcc -Wdiscarded-qualifiers + * tests/test-putenv.c (main): Don’t pass a string literal + to a function expecting ‘char *’. + alloca-opt-tests: add a ‘volatile’ * tests/test-alloca-opt.c (func) [HAVE_ALLOCA]: Now volatile, to foil whole-program optimization. diff --git a/tests/test-putenv.c b/tests/test-putenv.c index 1768e7563a..564c86713a 100644 --- a/tests/test-putenv.c +++ b/tests/test-putenv.c @@ -39,7 +39,7 @@ main (void) /* Verify adding an environment variable. */ { - ASSERT (putenv ("TEST_VAR=abc") == 0); + ASSERT (putenv ((char []) {"TEST_VAR=abc"}) == 0); ptr = getenv ("TEST_VAR"); ASSERT (ptr != NULL); ASSERT (STREQ (ptr, "abc")); @@ -47,13 +47,13 @@ main (void) /* Verify removing an environment variable. */ { - ASSERT (putenv ("TEST_VAR") == 0); + ASSERT (putenv ((char []) {"TEST_VAR"}) == 0); ASSERT (getenv ("TEST_VAR") == NULL); } /* Verify the behavior when removing a variable not in the environment. */ { - ASSERT (putenv ("TEST_VAR") == 0); + ASSERT (putenv ((char []) {"TEST_VAR"}) == 0); ASSERT (getenv ("TEST_VAR") == NULL); }