* 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                            | 10 ++++++++++
 tests/test-posix_spawn-dup2-stdin.c  |  4 +++-
 tests/test-posix_spawn-dup2-stdout.c |  4 +++-
 tests/test-posix_spawn-inherit0.c    |  4 +++-
 tests/test-posix_spawn-inherit1.c    |  4 +++-
 tests/test-posix_spawn-open1.c       |  4 +++-
 tests/test-posix_spawn-open2.c       |  4 +++-
 7 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5549e5ba1c..182e201051 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2026-01-13  Paul Eggert  <[email protected]>
 
+       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.
 
diff --git a/tests/test-posix_spawn-dup2-stdin.c 
b/tests/test-posix_spawn-dup2-stdin.c
index e3849e1fa3..bd87fea8a0 100644
--- a/tests/test-posix_spawn-dup2-stdin.c
+++ b/tests/test-posix_spawn-dup2-stdin.c
@@ -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;
diff --git a/tests/test-posix_spawn-dup2-stdout.c 
b/tests/test-posix_spawn-dup2-stdout.c
index 72b01a3edb..85f96f7344 100644
--- a/tests/test-posix_spawn-dup2-stdout.c
+++ b/tests/test-posix_spawn-dup2-stdout.c
@@ -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;
diff --git a/tests/test-posix_spawn-inherit0.c 
b/tests/test-posix_spawn-inherit0.c
index 2e5b22e9bb..3d8f78f94f 100644
--- a/tests/test-posix_spawn-inherit0.c
+++ b/tests/test-posix_spawn-inherit0.c
@@ -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;
diff --git a/tests/test-posix_spawn-inherit1.c 
b/tests/test-posix_spawn-inherit1.c
index 60fed5ed49..69aaeb4244 100644
--- a/tests/test-posix_spawn-inherit1.c
+++ b/tests/test-posix_spawn-inherit1.c
@@ -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;
diff --git a/tests/test-posix_spawn-open1.c b/tests/test-posix_spawn-open1.c
index 3dea387def..033e2b6b5d 100644
--- a/tests/test-posix_spawn-open1.c
+++ b/tests/test-posix_spawn-open1.c
@@ -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;
diff --git a/tests/test-posix_spawn-open2.c b/tests/test-posix_spawn-open2.c
index e26e93d33e..0b2ab70802 100644
--- a/tests/test-posix_spawn-open2.c
+++ b/tests/test-posix_spawn-open2.c
@@ -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;
-- 
2.51.0


Reply via email to