[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 2/2] build/printf: fix incorrect format specifiers



On 13/02/17 14:34, Roger Pau Monne wrote:
> The following incorrect format specifiers and incorrect number of parameters
> passed to printf like functions are reported by clang:
>
> mce.c:601:18: error: data argument not used by format string 
> [-Werror,-Wformat-extra-args]
>                  smp_processor_id());
>                  ^
>
> xenpm.c:102:23: error: data argument not used by format string 
> [-Werror,-Wformat-extra-args]
>                 what, argv[argc > 1]);
>                       ^
>
> libxl_internal.c:25:69: error: data argument not used by format string
>       [-Werror,-Wformat-extra-args]
>     libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, INVALID_DOMID, L);
>                                                                     ^
> libxl_internal.c:24:17: note: expanded from macro 'L'
>           func, (unsigned long)nmemb, (unsigned long)size
>                 ^
> libxl_internal.c:26:21: error: data argument not used by format string
>       [-Werror,-Wformat-extra-args]
>     fprintf(stderr, L);
>                     ^
> libxl_internal.c:24:17: note: expanded from macro 'L'
>           func, (unsigned long)nmemb, (unsigned long)size
>                 ^
>
> This patch contains the fixes for them and enabled -Wformat for clang.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> NB: FWIW, there's a way to disable extra arguments checks
> (-Wno-format-extra-args), that would prevent us from having to apply some of
> the changes here. However, given that there are not that many occurrences, I
> would rather leave the full checks of Wformat enabled.
>
> NB2: this has only been tested with a FreeBSD clang build (3.8.0), and only
> against the components that build on FreeBSD (ie: no qemu-trad, and certainly
> no blktap).
> ---
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: Christoph Egger <chegger@xxxxxxxxx>
> Cc: Liu Jinsong <jinsong.liu@xxxxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

+1 for all the checking.  It all leads to better code.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.