bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: avoid gcc warnings about argv vs. const initializers


From: Jim Meyering
Subject: [PATCH] tests: avoid gcc warnings about argv vs. const initializers
Date: Tue, 20 Mar 2012 20:38:51 +0100

Pulling a bunch of GNULIB_POSIXCHECK-inspired modules into coreutils
made it so that package is now compiling a few more test programs,
which evoked these failures:

  test-posix_spawn1.c: In function 'main':
  test-posix_spawn1.c:78:3: error: initialization discards 'const' qualifier 
from pointer target type [-Werror]
  test-posix_spawn1.c:78:3: error: initialization discards 'const' qualifier 
from pointer target type [-Werror]
  (and the same for test-posix_spawn2.c)

I've pushed this:

>From 880a2f6db9e37ef84347a47b15f88bef741c03da Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 20 Mar 2012 20:35:44 +0100
Subject: [PATCH] tests: avoid gcc warnings about argv vs. const initializers

* tests/test-posix_spawn1.c (main): Cast to "(char *)" to avoid two
warnings about discarding 'const' qualifier from pointer target type.
* tests/test-posix_spawn2.c (main): Likewise.
---
 ChangeLog                 |    7 +++++++
 tests/test-posix_spawn1.c |    2 +-
 tests/test-posix_spawn2.c |    2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 748f098..7b67d0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-20  Jim Meyering  <address@hidden>
+
+       tests: avoid gcc warnings about argv vs. const initializers
+       * tests/test-posix_spawn1.c (main): Cast to "(char *)" to avoid two
+       warnings about discarding 'const' qualifier from pointer target type.
+       * tests/test-posix_spawn2.c (main): Likewise.
+
 2012-03-20  Reuben Thomas  <address@hidden>

        README-release: simplify slightly
diff --git a/tests/test-posix_spawn1.c b/tests/test-posix_spawn1.c
index 9c41039..5152d5c 100644
--- a/tests/test-posix_spawn1.c
+++ b/tests/test-posix_spawn1.c
@@ -75,7 +75,7 @@ fd_safer (int fd)
 int
 main ()
 {
-  char *argv[3] = { "/bin/sh", CHILD_PROGRAM_FILENAME, NULL };
+  char *argv[3] = { (char *) "/bin/sh", (char *) CHILD_PROGRAM_FILENAME, NULL 
};
   int ifd[2];
   sigset_t blocked_signals;
   sigset_t fatal_signal_set;
diff --git a/tests/test-posix_spawn2.c b/tests/test-posix_spawn2.c
index 39479eb..e66c9f2 100644
--- a/tests/test-posix_spawn2.c
+++ b/tests/test-posix_spawn2.c
@@ -53,7 +53,7 @@ fd_safer (int fd)
 int
 main ()
 {
-  char *argv[3] = { "/bin/sh", CHILD_PROGRAM_FILENAME, NULL };
+  char *argv[3] = { (char *) "/bin/sh", (char *) CHILD_PROGRAM_FILENAME, NULL 
};
   int ofd[2];
   sigset_t blocked_signals;
   sigset_t fatal_signal_set;
--
1.7.10.rc1.23.g16a10



reply via email to

[Prev in Thread] Current Thread [Next in Thread]