From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 1/4] lib: *printf: warn on format/arg mismatch Date: Tue, 1 Mar 2016 11:43:06 +0100 Message-ID: <56D5723A.5090405@redhat.com> References: <1456777155-8599-1-git-send-email-drjones@redhat.com> <1456777155-8599-2-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: thuth@redhat.com, rkrcmar@redhat.com To: Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752287AbcCAKnL (ORCPT ); Tue, 1 Mar 2016 05:43:11 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id A697FC00F1CB for ; Tue, 1 Mar 2016 10:43:10 +0000 (UTC) In-Reply-To: <1456777155-8599-2-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 29/02/2016 21:19, Andrew Jones wrote: > Suggested-by: Thomas Huth > Signed-off-by: Andrew Jones > --- > lib/libcflat.h | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/lib/libcflat.h b/lib/libcflat.h > index 39100f29713b8..ce09d34e658b3 100644 > --- a/lib/libcflat.h > +++ b/lib/libcflat.h > @@ -51,13 +51,15 @@ typedef _Bool bool; > extern void puts(const char *s); > extern void exit(int code); > extern void abort(void); > - > -extern int printf(const char *fmt, ...); > -extern int snprintf(char *buf, int size, const char *fmt, ...); > -extern int vsnprintf(char *buf, int size, const char *fmt, va_list va); > -extern int vprintf(const char *fmt, va_list va); > extern long atol(const char *ptr); > > +#define _f(i,j) __attribute__((format(printf, i, j))) Please name this ATTRIBUTE_PRINTF. Paolo > +extern int printf(const char *fmt, ...) _f(1,2); > +extern int snprintf(char *buf, int size, const char *fmt, ...) _f(3,4); > +extern int vsnprintf(char *buf, int size, const char *fmt, va_list va) _f(3,0); > +extern int vprintf(const char *fmt, va_list va) _f(1,0); > +#undef _f > + > extern void report_prefix_push(const char *prefix); > extern void report_prefix_pop(void); > extern void report(const char *msg_fmt, bool pass, ...); >