From 9e1e9d8f3bac7fb52b026f0b628eb37d3a839097 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 11 Jun 2010 11:03:54 +0200 Subject: [PATCH] test-xvasprintf: avoid 'const' discard warnings * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Use "const" when assigning from literal strings. (test_xasprintf): Add "void" in function argument list to placate -Wstrict-prototypes and to be consistent with test_xvasprintf above. --- ChangeLog | 6 ++++++ tests/test-xvasprintf.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d96f7fe99..456a7936d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-06-11 Jim Meyering + test-xvasprintf: avoid 'const' discard warnings + * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Use + "const" when assigning from literal strings. + (test_xasprintf): Add "void" in function argument list to placate + -Wstrict-prototypes and to be consistent with test_xvasprintf above. + tests: avoid compilation warnings in argmatch and exclude tests... in packages that define ARGMATCH_DIE_DECL, like coreutils. * tests/test-exclude.c [ARGMATCH_DIE_DECL]: Also declare the function. diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c index df6c2009d..023067a45 100644 --- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -55,7 +55,7 @@ test_xvasprintf (void) { /* Silence gcc warning about zero-length format string. */ - char *empty = ""; + const char *empty = ""; result = my_xasprintf (empty); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); @@ -79,7 +79,7 @@ test_xvasprintf (void) } static void -test_xasprintf () +test_xasprintf (void) { int repeat; char *result; @@ -94,7 +94,7 @@ test_xasprintf () { /* Silence gcc warning about zero-length format string. */ - char *empty = ""; + const char *empty = ""; result = xasprintf (empty); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); -- 2.11.0