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

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

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]