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

Re: [libvirt] [PATCH 3/6] Enable -Wmissing-format-attribute warning



On 04/04/2011 10:20 AM, Daniel P. Berrange wrote:
> Add a couple of missing ATTRIBUTE_FMT_PRINTF annotations
> 
> * tools/virsh.c, tests/testutils.c: Add printf format attribute
> * m4/virt-compile-warnings.m4: Enable -Wmissing-format-attribute

>  
> -
> +ATTRIBUTE_FMT_PRINTF(3,4)
>  void virtTestResult(const char *name, int ret, const char *msg, ...)

gcc attribute syntax is screwy.

I'm somewhat used to:

void ATTRIBUTE_FMT_PRINTF(3,4)
virtTestResult(...)

but if doing the attribute before the return type works, great.

>  {
>      va_list vargs;
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 19e3449..4765f5c 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -243,7 +243,8 @@ static int vshInit(vshControl *ctl);
>  static int vshDeinit(vshControl *ctl);
>  static void vshUsage(void);
>  static void vshOpenLogFile(vshControl *ctl);
> -static void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, va_list ap);
> +static void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, va_list ap)
> +    ATTRIBUTE_FMT_PRINTF(3, 0);
>  static void vshCloseLogFile(vshControl *ctl);

ACK (although rebasing this to apply before we fix patch 2/6 vs. gnulib
bootstrap may not be worth your time).

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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