On 07/08/2011 03:33 PM, Jim Meyering wrote: > In case someone else finds time to address these new warnings: > > test-sigprocmask.c: In function 'main': > test-sigprocmask.c:66:10: error: ignoring return value of 'system', declared > with attribute warn_unused_result [-Werror=unused-result] > cc1: all warnings being treated as errors > > make[8]: *** [test-sigprocmask.o] Error 1 > make[8]: *** Waiting for unfinished jobs.... > CC test-strftime.o > test-snprintf.c: In function 'main': > test-snprintf.c:68:9: error: declaration of 'retval' shadows a previous local > [-Werror=shadow] > test-snprintf.c:37:7: error: shadowed declaration is here [-Werror=shadow] > cc1: all warnings being treated as errors
Both fixed now. From 71af89e818c5673a6b3ded7f9dbd78015222fb90 Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Fri, 8 Jul 2011 15:57:31 -0600 Subject: [PATCH 1/2] test-snprintf: avoid compiler warning * tests/test-snprintf.c (main): Avoid shadowed declaration. * tests/test-vsnprintf.c (main): Likewise. Reported by Jim Meyering. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 7 +++++++ tests/test-snprintf.c | 2 +- tests/test-vsnprintf.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 465ccaf..2465f4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-07-08 Eric Blake <[email protected]> + + test-snprintf: avoid compiler warning + * tests/test-snprintf.c (main): Avoid shadowed declaration. + * tests/test-vsnprintf.c (main): Likewise. + Reported by Jim Meyering. + 2011-07-08 Bruno Haible <[email protected]> Tests for module 'pthread_sigmask'. diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c index 18efed5..2b5a54c 100644 --- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -63,7 +63,7 @@ main (int argc, char *argv[]) /* Test the support of the POSIX/XSI format strings with positions. */ { char result[100]; - int retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); + retval = snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); ASSERT (strcmp (result, "55 33") == 0); ASSERT (retval == strlen (result)); } diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c index 6711f39..7a52082 100644 --- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -76,7 +76,7 @@ main (int argc, char *argv[]) /* Test the support of the POSIX/XSI format strings with positions. */ { char result[100]; - int retval = my_snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); + retval = my_snprintf (result, sizeof (result), "%2$d %1$d", 33, 55); ASSERT (strcmp (result, "55 33") == 0); ASSERT (retval == strlen (result)); } -- 1.7.4.4 From b80db060001e52a487a0502a6258156cbeea2a8a Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Fri, 8 Jul 2011 15:55:40 -0600 Subject: [PATCH 2/2] test-sigprocmask: avoid compiler warning * modules/sigprocmask-tests (Depends-on): Add ignore-value. * tests/test-sigprocmask.c (main): Use it to silence warning. Reported by Jim Meyering. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 5 +++++ modules/sigprocmask-tests | 1 + tests/test-sigprocmask.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2465f4c..ade6539 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-07-08 Eric Blake <[email protected]> + test-sigprocmask: avoid compiler warning + * modules/sigprocmask-tests (Depends-on): Add ignore-value. + * tests/test-sigprocmask.c (main): Use it to silence warning. + Reported by Jim Meyering. + test-snprintf: avoid compiler warning * tests/test-snprintf.c (main): Avoid shadowed declaration. * tests/test-vsnprintf.c (main): Likewise. diff --git a/modules/sigprocmask-tests b/modules/sigprocmask-tests index 80fcd81..f6c0410 100644 --- a/modules/sigprocmask-tests +++ b/modules/sigprocmask-tests @@ -4,6 +4,7 @@ tests/signature.h tests/macros.h Depends-on: +ignore-value sleep configure.ac: diff --git a/tests/test-sigprocmask.c b/tests/test-sigprocmask.c index 628c1ab..973c5d8 100644 --- a/tests/test-sigprocmask.c +++ b/tests/test-sigprocmask.c @@ -28,6 +28,7 @@ SIGNATURE_CHECK (sigprocmask, int, (int, const sigset_t *, sigset_t *)); #include <stdlib.h> #include <unistd.h> +#include "ignore-value.h" #include "macros.h" #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) @@ -61,7 +62,7 @@ main (int argc, char *argv[]) /* Request a SIGINT signal from outside. */ sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid); - system (command); + ignore_value (system (command)); /* Wait. */ sleep (2); -- 1.7.4.4 -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
