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....@citrix.com>
> ---
> 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.jack...@eu.citrix.com>
> Cc: Wei Liu <wei.l...@citrix.com>
> Cc: Christoph Egger <cheg...@amazon.de>
> Cc: Liu Jinsong <jinsong....@alibaba-inc.com>
> Cc: Jan Beulich <jbeul...@suse.com>
> Cc: Andrew Cooper <andrew.coop...@citrix.com>

Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

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

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

Reply via email to