]> Savannah Git Hosting - gnulib.git/commitdiff
putenv-tests: pacify gcc -Wdiscarded-qualifiers
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 May 2024 05:40:59 +0000 (22:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 May 2024 05:42:01 +0000 (22:42 -0700)
* tests/test-putenv.c (main): Don’t pass a string literal
to a function expecting ‘char *’.

ChangeLog
tests/test-putenv.c

index a8ed30c4ae9c626f8564efdddb6b6a614955f1cb..5238067cf986ed64417f2428b4e099d3d889131b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2024-05-16  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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.
index 1768e7563a2290014e3d315b9cb639969b4f51fc..564c86713a4c46eae3b82f799e3c16eed1c83aab 100644 (file)
@@ -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);
   }