On 03/31/2012 09:44 AM, Gilles Espinasse wrote:
> Visible with gcc-4.4.5 with defaults-format-security.patch
> 
> test-xvasprintf.c: In function 'test_xasprintf':
> test-xvasprintf.c:98: warning: format not a string literal and no format 
> arguments
> 
> Signed-off-by: Gilles Espinasse <g....@free.fr>
> ---
>  tests/test-xvasprintf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c
> index 4a90059..fc54d94 100644
> --- a/tests/test-xvasprintf.c
> +++ b/tests/test-xvasprintf.c
> @@ -95,7 +95,7 @@ test_xasprintf (void)
>    {
>      /* Silence gcc warning about zero-length format string.  */
>      const char *empty = "";
> -    result = xasprintf (empty);
> +    result = xasprintf ("%s", empty);

NACK.  The whole point of this test is to make sure the format string of
"" is handled correctly, but your patch would change the format string
to non-empty.

What is really needed is a way to shut up the gcc warning, as it only
gets in the way of this test.  Adding an appropriate #pragma at the top
of the file is the proper solution.

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to