From patchwork Thu Sep 23 19:28:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 65573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 567DEB70DA for ; Fri, 24 Sep 2010 05:29:15 +1000 (EST) Received: from localhost ([127.0.0.1]:43651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyrTk-0003sL-Jy for incoming@patchwork.ozlabs.org; Thu, 23 Sep 2010 15:29:12 -0400 Received: from [140.186.70.92] (port=60313 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyrSk-0003qV-Ri for qemu-devel@nongnu.org; Thu, 23 Sep 2010 15:28:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyrSj-0005gG-Fu for qemu-devel@nongnu.org; Thu, 23 Sep 2010 15:28:10 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:62894) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyrSj-0005g5-2g for qemu-devel@nongnu.org; Thu, 23 Sep 2010 15:28:09 -0400 Received: from flocke.weilnetz.de (p54ADB0BB.dip.t-dialin.net [84.173.176.187]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0Lr6Nr-1OKJme0t2x-00e78E; Thu, 23 Sep 2010 21:28:07 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.72) (envelope-from ) id 1OyrSg-0002wQ-Ck; Thu, 23 Sep 2010 21:28:06 +0200 From: Stefan Weil To: QEMU Developers Date: Thu, 23 Sep 2010 21:28:03 +0200 Message-Id: <1285270085-11276-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.7.1 X-Provags-ID: V02:K0:Y3JcTXY14ULA9ejCmJh7aa7uIBDM03mapGZgVGGQu6j rvR1eQVpGrtPbWjjobnW3E61KDWhPQPILTT5YEP6PQWgeeo7zd gKmpJy0Db2jRelIc5PfA0aFk1ZqsE1gc0fo9hIBuExiPIoKxQ2 OeWtgIDL1BrLs31inP3nSGSbebiKvYVHD+6ipiIzzvAwxygFHW KfaedN3y1rSw8BXzWj3e67kDYg0FMEc2ifkTHYffRJ+NNY+r12 4/7NHZVn/n7ax X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Blue Swirl Subject: [Qemu-devel] [PATCH 1/3] Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since version 4.4.x, gcc supports additional format attributes. __attribute__ ((format (gnu_printf, 1, 2))) should be used instead of __attribute__ ((format (printf, 1, 2)) because QEMU always uses standard format strings (even with mingw32). The patch replaces format attribute printf / __printf__ by macro GCC_FMT_ATTR which uses gnu_printf if supported. It also removes an #ifdef __GNUC__ (not needed any longer). Cc: Blue Swirl Signed-off-by: Stefan Weil --- audio/audio.h | 6 +----- bsd-user/qemu.h | 2 +- darwin-user/qemu.h | 2 +- hw/xen_backend.h | 2 +- linux-user/qemu.h | 2 +- monitor.h | 3 +-- qemu-common.h | 3 +-- qemu-error.h | 7 +++---- qerror.h | 3 +-- qjson.h | 3 +-- 10 files changed, 12 insertions(+), 21 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 454ade2..39a0631 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -87,11 +87,7 @@ typedef struct QEMUAudioTimeStamp { } QEMUAudioTimeStamp; void AUD_vlog (const char *cap, const char *fmt, va_list ap); -void AUD_log (const char *cap, const char *fmt, ...) -#ifdef __GNUC__ - __attribute__ ((__format__ (__printf__, 2, 3))) -#endif - ; +void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void AUD_help (void); void AUD_register_card (const char *name, QEMUSoundCard *card); diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 554ff8b..9763616 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -139,7 +139,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); -void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); +void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); extern THREAD CPUState *thread_env; void cpu_loop(CPUState *env); char *target_strerror(int err); diff --git a/darwin-user/qemu.h b/darwin-user/qemu.h index 462bbda..0c5081b 100644 --- a/darwin-user/qemu.h +++ b/darwin-user/qemu.h @@ -99,7 +99,7 @@ int do_sigaction(int sig, const struct sigaction *act, struct sigaction *oact); int do_sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss); -void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); +void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void qerror(const char *fmt, ...); void write_dt(void *ptr, unsigned long addr, unsigned long limit, int flags); diff --git a/hw/xen_backend.h b/hw/xen_backend.h index 292126d..1b428e3 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -84,7 +84,7 @@ int xen_be_bind_evtchn(struct XenDevice *xendev); void xen_be_unbind_evtchn(struct XenDevice *xendev); int xen_be_send_notify(struct XenDevice *xendev); void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, ...) - __attribute__ ((format(printf, 3, 4))); + GCC_FMT_ATTR(3, 4); /* actual backend drivers */ extern struct XenDevOps xen_console_ops; /* xen_console.c */ diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 794fe49..708021e 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -186,7 +186,7 @@ void syscall_init(void); abi_long do_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); -void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2))); +void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); extern THREAD CPUState *thread_env; void cpu_loop(CPUState *env); char *target_strerror(int err); diff --git a/monitor.h b/monitor.h index 38b22a4..185cc3e 100644 --- a/monitor.h +++ b/monitor.h @@ -50,8 +50,7 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, int monitor_get_fd(Monitor *mon, const char *fdname); void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap); -void monitor_printf(Monitor *mon, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); +void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void monitor_print_filename(Monitor *mon, const char *filename); void monitor_flush(Monitor *mon); diff --git a/qemu-common.h b/qemu-common.h index 88c5207..81aafa0 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -196,8 +196,7 @@ int qemu_pipe(int pipefd[2]); /* Error handling. */ -void QEMU_NORETURN hw_error(const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); +void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2); /* IO callbacks. */ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size); diff --git a/qemu-error.h b/qemu-error.h index a45609f..531ec63 100644 --- a/qemu-error.h +++ b/qemu-error.h @@ -31,11 +31,10 @@ void loc_set_cmdline(char **argv, int idx, int cnt); void loc_set_file(const char *fname, int lno); void error_vprintf(const char *fmt, va_list ap); -void error_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); -void error_printf_unless_qmp(const char *fmt, ...) - __attribute__ ((format(printf, 1, 2))); +void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_print_loc(void); void error_set_progname(const char *argv0); -void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); +void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2); #endif diff --git a/qerror.h b/qerror.h index 62802ea..f2984dd 100644 --- a/qerror.h +++ b/qerror.h @@ -38,8 +38,7 @@ QError *qerror_from_info(const char *file, int linenr, const char *func, QString *qerror_human(const QError *qerror); void qerror_print(QError *qerror); void qerror_report_internal(const char *file, int linenr, const char *func, - const char *fmt, ...) - __attribute__ ((format(printf, 4, 5))); + const char *fmt, ...) GCC_FMT_ATTR(4, 5); #define qerror_report(fmt, ...) \ qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) QError *qobject_to_qerror(const QObject *obj); diff --git a/qjson.h b/qjson.h index 7afec2e..7eef357 100644 --- a/qjson.h +++ b/qjson.h @@ -19,8 +19,7 @@ #include "qstring.h" QObject *qobject_from_json(const char *string); -QObject *qobject_from_jsonf(const char *string, ...) - __attribute__((__format__ (__printf__, 1, 2))); +QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); QObject *qobject_from_jsonv(const char *string, va_list *ap); QString *qobject_to_json(const QObject *obj);