With the warnings enabled by coreutils and its -Werror, I saw this:

  test-readtokens.c: In function 'basic':
  test-readtokens.c:33:20: error: initialization discards 'const' qualifier 
from pointer target type [-Werror]
  test-readtokens.c: In function 'main':
  test-readtokens.c:80:13: error: assignment discards 'const' qualifier from 
pointer target type [-Werror]
  cc1: all warnings being treated as errors

So I made this additional change:


>From d42a16b0fce4238daad80779ffa169b56696ff96 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@redhat.com>
Date: Thu, 8 Mar 2012 08:25:08 +0100
Subject: [PATCH] test-readtokens.c: avoid const-related compilation warnings

* tests/test-readtokens.c: Avoid const-related compilation warnings.
---
 ChangeLog               |    5 +++++
 tests/test-readtokens.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a2bb84e..c616363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-08  Jim Meyering  <meyer...@redhat.com>
+
+       test-readtokens.c: avoid const-related compilation warnings
+       * tests/test-readtokens.c: Avoid const-related compilation warnings.
+
 2012-03-07  Jim Meyering  <meyer...@redhat.com>
            Bruno Haible  <br...@clisp.org>

diff --git a/tests/test-readtokens.c b/tests/test-readtokens.c
index 1ee0c86..f12d39e 100644
--- a/tests/test-readtokens.c
+++ b/tests/test-readtokens.c
@@ -30,7 +30,7 @@
 static void
 basic (void)
 {
-  char *filename = "in.827";
+  char const *filename = "in.827";
   int fd = open (filename, O_CREAT | O_WRONLY, 0600);
   ASSERT (fd >= 0);
   ASSERT (write (fd, "a|b;c+d", 7) == 7);
@@ -77,7 +77,7 @@ main (int argc, char **argv)

   if (STREQ (delim, "\\0"))
     {
-      delim = "";
+      delim = (char *) "";
       delim_len = 1;
     }

--
1.7.9.3.363.g121f0

Reply via email to