]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
maint: pacify -Wdiscarded-qualifiers
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Jan 2026 16:10:50 +0000 (08:10 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Jan 2026 16:11:40 +0000 (08:11 -0800)
* tests/test-posix_spawn-dup2-stdin.c (main):
* tests/test-posix_spawn-dup2-stdout.c (main):
* tests/test-posix_spawn-inherit0.c (parent_main):
* tests/test-posix_spawn-inherit1.c (parent_main):
* tests/test-posix_spawn-open1.c (parent_main):
* tests/test-posix_spawn-open2.c (parent_main):
Reword to avoid need to cast string literals to char *,
while also pacifying gcc -Wdiscarded-qualifiers.

ChangeLog
tests/test-posix_spawn-dup2-stdin.c
tests/test-posix_spawn-dup2-stdout.c
tests/test-posix_spawn-inherit0.c
tests/test-posix_spawn-inherit1.c
tests/test-posix_spawn-open1.c
tests/test-posix_spawn-open2.c

index 5549e5ba1c772352d628d371e7acddf50909cd9b..182e2010511102820bcca4e8f9688118d4d31b2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2026-01-13  Paul Eggert  <eggert@cs.ucla.edu>
 
+       maint: pacify -Wdiscarded-qualifiers
+       * tests/test-posix_spawn-dup2-stdin.c (main):
+       * tests/test-posix_spawn-dup2-stdout.c (main):
+       * tests/test-posix_spawn-inherit0.c (parent_main):
+       * tests/test-posix_spawn-inherit1.c (parent_main):
+       * tests/test-posix_spawn-open1.c (parent_main):
+       * tests/test-posix_spawn-open2.c (parent_main):
+       Reword to avoid need to cast string literals to char *,
+       while also pacifying gcc -Wdiscarded-qualifiers.
+
        trunc-tests: pacify -Wmissing-prototypes
        * tests/test-trunc2.c (trunc_reference): Now static.
 
index e3849e1fa32831bd8fcae99902b386839c87c931..bd87fea8a028b06d1d039e9b3709979245877b49 100644 (file)
@@ -50,7 +50,9 @@ fd_safer (int fd)
 int
 main ()
 {
-  char *argv[3] = { (char *) BOURNE_SHELL, (char *) CHILD_PROGRAM_FILENAME, NULL };
+  char argv0[] = BOURNE_SHELL;
+  char argv1[] = CHILD_PROGRAM_FILENAME;
+  char *argv[] = { argv0, argv1, NULL };
   int ofd[2];
   sigset_t blocked_signals;
   sigset_t fatal_signal_set;
index 72b01a3edbff9500884929dc2757768223babc97..85f96f73449266925a85f828735463c51c1b5ae8 100644 (file)
@@ -72,7 +72,9 @@ fd_safer (int fd)
 int
 main ()
 {
-  char *argv[3] = { (char *) BOURNE_SHELL, (char *) CHILD_PROGRAM_FILENAME, NULL };
+  char argv0[] = BOURNE_SHELL;
+  char argv1[] = CHILD_PROGRAM_FILENAME;
+  char *argv[] = { argv0, argv1, NULL };
   int ifd[2];
   sigset_t blocked_signals;
   sigset_t fatal_signal_set;
index 2e5b22e9bb55a7a7a7ad823f9b3ffd9f4fdf43a3..3d8f78f94fb2109032e422623d43b713d8ba9fa6 100644 (file)
@@ -38,7 +38,9 @@ static int
 parent_main (void)
 {
   FILE *fp;
-  char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL };
+  char argv0[] = CHILD_PROGRAM_FILENAME;
+  char argv1[] = "-child";
+  char *argv[] = { argv0, argv1, NULL };
   int err;
   pid_t child;
   int status;
index 60fed5ed49b6723a795600912682efa4d9fe319d..69aaeb424441e1f39dd1cdb047fd678fbde3828c 100644 (file)
@@ -38,7 +38,9 @@ static int
 parent_main (void)
 {
   FILE *fp;
-  char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL };
+  char argv0[] = CHILD_PROGRAM_FILENAME;
+  char argv1[] = "-child";
+  char *argv[] = { argv0, argv1, NULL };
   int err;
   pid_t child;
   int status;
index 3dea387defcca998d394fe2ab5c8106e4a658e94..033e2b6b5d5f1ec8374c4cbe1fe0139452ebe606 100644 (file)
@@ -50,7 +50,9 @@ static int
 parent_main (void)
 {
   FILE *fp;
-  char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL };
+  char argv0[] = CHILD_PROGRAM_FILENAME;
+  char argv1[] = "-child";
+  char *argv[] = { argv0, argv1, NULL };
   posix_spawn_file_actions_t actions;
   bool actions_allocated;
   int err;
index e26e93d33e21ebf4981f6ee5263e3837362dc0bd..0b2ab708024111b8ba802499b3cc4375ecff886a 100644 (file)
@@ -38,7 +38,9 @@ static int
 parent_main (void)
 {
   FILE *fp;
-  char *argv[3] = { CHILD_PROGRAM_FILENAME, "-child", NULL };
+  char argv0[] = CHILD_PROGRAM_FILENAME;
+  char argv1[] = "-child";
+  char *argv[] = { argv0, argv1, NULL };
   posix_spawn_file_actions_t actions;
   bool actions_allocated;
   int err;