kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: thuth@redhat.com, rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH 1/4] lib: *printf: warn on format/arg mismatch
Date: Tue, 1 Mar 2016 11:43:06 +0100	[thread overview]
Message-ID: <56D5723A.5090405@redhat.com> (raw)
In-Reply-To: <1456777155-8599-2-git-send-email-drjones@redhat.com>



On 29/02/2016 21:19, Andrew Jones wrote:
> Suggested-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  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, ...);
> 

  reply	other threads:[~2016-03-01 10:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 20:19 [kvm-unit-tests PATCH 0/4] add fmt warnings to printf, and fix bad uses Andrew Jones
2016-02-29 20:19 ` [kvm-unit-tests PATCH 1/4] lib: *printf: warn on format/arg mismatch Andrew Jones
2016-03-01 10:43   ` Paolo Bonzini [this message]
2016-03-01 11:01     ` Andrew Jones
2016-02-29 20:19 ` [kvm-unit-tests PATCH 2/4] lib/alloc: fix format warnings, add/use PRIx64 Andrew Jones
2016-03-01  4:58   ` Thomas Huth
2016-03-01  9:15     ` Andrew Jones
2016-03-01 11:04       ` Paolo Bonzini
2016-03-01 12:22         ` Andrew Jones
2016-03-01 10:47   ` Paolo Bonzini
2016-02-29 20:19 ` [kvm-unit-tests PATCH 3/4] arm64: fix printf format warnings Andrew Jones
2016-03-01  5:01   ` Thomas Huth
2016-03-01  9:17     ` Andrew Jones
2016-02-29 20:19 ` [kvm-unit-tests PATCH 4/4] x86: " Andrew Jones
2016-03-01  5:30   ` Thomas Huth
2016-03-01  9:24     ` Andrew Jones
2016-03-01 10:52       ` Paolo Bonzini
2016-03-01 11:02         ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D5723A.5090405@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).