xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: xen-devel@lists.xenproject.org
Cc: raphning@amazon.co.uk, iwj@xenproject.org,
	Julien Grall <jgrall@amazon.com>, Wei Liu <wl@xen.org>,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH for-4.15 2/2] tools/xenstore: Check the format printf for xprintf() and barf{,_perror}()
Date: Fri,  5 Mar 2021 12:40:03 +0000	[thread overview]
Message-ID: <20210305124003.13582-3-julien@xen.org> (raw)
In-Reply-To: <20210305124003.13582-1-julien@xen.org>

From: Julien Grall <jgrall@amazon.com>

Allow GCC to analyze the format printf for xprintf() and
barf{,_perror}().

Take the opportunity to define __noreturn to make the prototype for
barf{,_perror})() easier to read.

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/utils.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index 3dfb96b556dd..ccfb9b8fb699 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -29,10 +29,12 @@ const char *dump_state_align(FILE *fp);
 
 #define PRINTF_ATTRIBUTE(a1, a2) __attribute__((format (printf, a1, a2)))
 
-void barf(const char *fmt, ...) __attribute__((noreturn));
-void barf_perror(const char *fmt, ...) __attribute__((noreturn));
+#define __noreturn __attribute__((noreturn))
 
-extern void (*xprintf)(const char *fmt, ...);
+void barf(const char *fmt, ...) __noreturn PRINTF_ATTRIBUTE(1, 2);
+void barf_perror(const char *fmt, ...) __noreturn PRINTF_ATTRIBUTE(1, 2);
+
+extern void (*xprintf)(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
 
 #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
 
-- 
2.17.1



  parent reply	other threads:[~2021-03-05 12:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 12:40 [PATCH for-4.15 0/2] xenstore: Check format printf Julien Grall
2021-03-05 12:40 ` [PATCH for-4.15 1/2] tools/xenstore: Consolidate PRINTF_ATTRIBUTE() in utils.h Julien Grall
2021-03-05 13:00   ` Jürgen Groß
2021-03-05 13:24   ` Ian Jackson
2021-03-05 12:40 ` Julien Grall [this message]
2021-03-05 13:01   ` [PATCH for-4.15 2/2] tools/xenstore: Check the format printf for xprintf() and barf{,_perror}() Jürgen Groß
2021-03-05 13:27     ` Ian Jackson
2021-03-05 13:32       ` Julien Grall
2021-03-05 13:45     ` Jan Beulich
2021-03-05 13:48       ` Andrew Cooper
2021-03-05 13:48       ` Julien Grall
2021-03-05 13:58         ` Ian Jackson
2021-03-06 19:37           ` Julien Grall
2021-03-08  9:44             ` Ian Jackson
2021-03-11  9:48               ` Julien Grall
2021-03-05 13:24   ` Ian Jackson

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=20210305124003.13582-3-julien@xen.org \
    --to=julien@xen.org \
    --cc=iwj@xenproject.org \
    --cc=jgrall@amazon.com \
    --cc=jgross@suse.com \
    --cc=raphning@amazon.co.uk \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).