From: Paul Eggert Date: Tue, 13 Jan 2026 16:10:50 +0000 (-0800) Subject: maint: pacify -Wdiscarded-qualifiers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7606f1f29c58281b19cde8e14a0fea2ff638d2a5;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 5549e5ba1c..182e201051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2026-01-13 Paul Eggert + 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;