From patchwork Mon Sep 13 20:02:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 64644 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 E03F7B6EDD for ; Tue, 14 Sep 2010 06:06:00 +1000 (EST) Received: from localhost ([127.0.0.1]:45741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvFHp-0004nE-7S for incoming@patchwork.ozlabs.org; Mon, 13 Sep 2010 16:05:57 -0400 Received: from [140.186.70.92] (port=47805 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvFEl-0003Ts-J2 for qemu-devel@nongnu.org; Mon, 13 Sep 2010 16:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvFEj-0004b5-SG for qemu-devel@nongnu.org; Mon, 13 Sep 2010 16:02:47 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:50322) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvFEj-0004ar-CN for qemu-devel@nongnu.org; Mon, 13 Sep 2010 16:02:45 -0400 Received: from flocke.weilnetz.de (p54ADB004.dip.t-dialin.net [84.173.176.4]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MIhBo-1Ot3Nb3mI4-002ikD; Mon, 13 Sep 2010 22:02:44 +0200 Received: from stefan by flocke.weilnetz.de with local (Exim 4.72) (envelope-from ) id 1OvFEh-0004VD-1Y; Mon, 13 Sep 2010 22:02:43 +0200 From: Stefan Weil To: QEMU Developers Date: Mon, 13 Sep 2010 22:02:37 +0200 Message-Id: <1284408157-17276-2-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1284187585-20953-2-git-send-email-weil@mail.berlios.de> References: <1284187585-20953-2-git-send-email-weil@mail.berlios.de> X-Provags-ID: V02:K0:2t16pQGuISIF78OfX81mq8V6dKWSoaJY6b8UWXX25kv VIx0t8HeBtHJ2hiw2ZeTZd69Y+9lBJi3B4Sdkg4aZ9OvfMGLl2 icKVVmAtAlq0LJL+j5q9ZGiKjt+svu4myiDKoGyGUaHWID5pSA FzvbVdjfFvGdaignlKtkuLWJdUl7zVbbRORaR+wiDaQezsOHVL Y3lSiUjo3WhvOWh1ItblKt6q3LVqhTPv0VJlqHlbeKSOhQYMzI kXrmNchj3m/wE X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH 2/2] Use new gcc format attribute gnu_printf 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 gnu_printf. It also removes an #ifdef __GNUC__ (not needed as long as we compile with gcc, and for non-gcc compilers we need more changes than this). The gcc documentation uses format (not __format__), the majority in QEMU uses this shorter form, too. Therefore the patch also replaces __format__ by format. Spacing was unified (again as in the gcc documentation). Signed-off-by: Stefan Weil --- audio/audio.h | 5 +---- audio/audio_int.h | 4 ++-- bsd-user/qemu.h | 2 +- cpu-all.h | 2 +- darwin-user/qemu.h | 2 +- hw/xen_backend.h | 2 +- linux-user/qemu.h | 2 +- monitor.h | 2 +- qemu-common.h | 2 +- qemu-error.h | 8 +++++--- qerror.h | 2 +- qjson.h | 2 +- 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/audio/audio.h b/audio/audio.h index 454ade2..4439b82 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -88,10 +88,7 @@ typedef struct 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 - ; + __attribute__ ((format (gnu_printf, 2, 3))); void AUD_help (void); void AUD_register_card (const char *name, QEMUSoundCard *card); diff --git a/audio/audio_int.h b/audio/audio_int.h index 06e313f..f6a77ad 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -237,8 +237,8 @@ static inline int audio_ring_dist (int dst, int src, int len) } #if defined __GNUC__ -#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2))) -#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m))) +#define GCC_ATTR __attribute__ ((__unused__, format (gnu_printf, 1, 2))) +#define GCC_FMT_ATTR(n, m) __attribute__ ((format (gnu_printf, n, m))) #else #define GCC_ATTR /**/ #define GCC_FMT_ATTR(n, m) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 554ff8b..34407aa 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, ...) __attribute__((format (gnu_printf, 1, 2))); extern THREAD CPUState *thread_env; void cpu_loop(CPUState *env); char *target_strerror(int err); diff --git a/cpu-all.h b/cpu-all.h index 67a3266..183bb40 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -773,7 +773,7 @@ void cpu_dump_statistics (CPUState *env, FILE *f, int flags); void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); + __attribute__ ((format (gnu_printf, 2, 3))); extern CPUState *first_cpu; extern CPUState *cpu_single_env; diff --git a/darwin-user/qemu.h b/darwin-user/qemu.h index 462bbda..2df2bc9 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, ...) __attribute__((format (gnu_printf, 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..5b78182 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))); + __attribute__ ((format (gnu_printf, 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..779d892 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, ...) __attribute__ ((format (gnu_printf, 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..d4c3872 100644 --- a/monitor.h +++ b/monitor.h @@ -51,7 +51,7 @@ 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))); + __attribute__ ((format (gnu_printf, 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 dfd3dc0..956b545 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -181,7 +181,7 @@ int qemu_pipe(int pipefd[2]); /* Error handling. */ void QEMU_NORETURN hw_error(const char *fmt, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); + __attribute__ ((format (gnu_printf, 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..25f2bfb 100644 --- a/qemu-error.h +++ b/qemu-error.h @@ -31,11 +31,13 @@ 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(const char *fmt, ...) + __attribute__ ((format (gnu_printf, 1, 2))); void error_printf_unless_qmp(const char *fmt, ...) - __attribute__ ((format(printf, 1, 2))); + __attribute__ ((format (gnu_printf, 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, ...) + __attribute__ ((format (gnu_printf, 1, 2))); #endif diff --git a/qerror.h b/qerror.h index 62802ea..fbabe89 100644 --- a/qerror.h +++ b/qerror.h @@ -39,7 +39,7 @@ 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))); + __attribute__ ((format (gnu_printf, 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..b21423a 100644 --- a/qjson.h +++ b/qjson.h @@ -20,7 +20,7 @@ QObject *qobject_from_json(const char *string); QObject *qobject_from_jsonf(const char *string, ...) - __attribute__((__format__ (__printf__, 1, 2))); + __attribute__((format (gnu_printf, 1, 2))); QObject *qobject_from_jsonv(const char *string, va_list *ap); QString *qobject_to_json(const QObject *obj);