[libvirt] [PATCH 3/6] Enable -Wmissing-format-attribute warning
Eric Blake
eblake at redhat.com
Mon Apr 4 20:40:28 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110404/014a92dc/attachment-0001.sig>
More information about the libvir-list
mailing list