Mercurial > hg > octave-lojdl > gnulib-hg
changeset 12323:dd9a1c6c56b4
test-xvasprintf: silence compiler warnings
* tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Mask
empty string from gcc.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 19 Nov 2009 08:51:13 -0700 |
parents | be4fcf937c17 |
children | 1e925352367b |
files | ChangeLog tests/test-xvasprintf.c |
diffstat | 2 files changed, 22 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-19 Eric Blake <ebb9@byu.net> + + test-xvasprintf: silence compiler warnings + * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Mask + empty string from gcc. + 2009-11-19 Jim Meyering <meyering@redhat.com> xfreopen: new module, from coreutils
--- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -65,10 +65,14 @@ free (result); } - result = my_xasprintf (""); - ASSERT (result != NULL); - ASSERT (strcmp (result, "") == 0); - free (result); + { + /* Silence gcc warning about zero-length format string. */ + char *empty = ""; + result = my_xasprintf (empty); + ASSERT (result != NULL); + ASSERT (strcmp (result, "") == 0); + free (result); + } result = my_xasprintf ("%s", "foo"); ASSERT (result != NULL); @@ -100,10 +104,14 @@ free (result); } - result = xasprintf (""); - ASSERT (result != NULL); - ASSERT (strcmp (result, "") == 0); - free (result); + { + /* Silence gcc warning about zero-length format string. */ + char *empty = ""; + result = xasprintf (empty); + ASSERT (result != NULL); + ASSERT (strcmp (result, "") == 0); + free (result); + } result = xasprintf ("%s", "foo"); ASSERT (result != NULL);