Use GCC_FMT_ATTR (format checking)

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Stefan Weil 2010-09-23 21:28:05 +02:00 committed by Blue Swirl
parent e5924d8980
commit 8b7968f7c4
14 changed files with 25 additions and 16 deletions

View File

@ -86,7 +86,7 @@ typedef struct QEMUAudioTimeStamp {
uint64_t old_ts; uint64_t old_ts;
} QEMUAudioTimeStamp; } QEMUAudioTimeStamp;
void AUD_vlog (const char *cap, const char *fmt, va_list ap); void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
void AUD_help (void); void AUD_help (void);

View File

@ -349,7 +349,8 @@ monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
return 0; return 0;
} }
static int monitor_fprintf(FILE *stream, const char *fmt, ...) static int GCC_FMT_ATTR(2, 3)
monitor_fprintf(FILE *stream, const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -76,7 +76,8 @@ static struct _loaderparams {
const char *initrd_filename; const char *initrd_filename;
} loaderparams; } loaderparams;
static void prom_set(uint32_t* prom_buf, int index, const char *string, ...) static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t* prom_buf, int index,
const char *string, ...)
{ {
va_list ap; va_list ap;
int32_t table_addr; int32_t table_addr;

View File

@ -654,7 +654,8 @@ static void write_bootloader (CPUState *env, uint8_t *base,
} }
static void prom_set(uint32_t* prom_buf, int index, const char *string, ...) static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t* prom_buf, int index,
const char *string, ...)
{ {
va_list ap; va_list ap;
int32_t table_addr; int32_t table_addr;

View File

@ -91,7 +91,8 @@ static int token_is_escape(QObject *obj, const char *value)
/** /**
* Error handler * Error handler
*/ */
static void parse_error(JSONParserContext *ctxt, QObject *token, const char *msg, ...) static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt,
QObject *token, const char *msg, ...)
{ {
va_list ap; va_list ap;
va_start(ap, msg); va_start(ap, msg);

View File

@ -316,7 +316,8 @@ void monitor_print_filename(Monitor *mon, const char *filename)
} }
} }
static int monitor_fprintf(FILE *stream, const char *fmt, ...) static int GCC_FMT_ATTR(2, 3) monitor_fprintf(FILE *stream,
const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -49,7 +49,8 @@ int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
int monitor_get_fd(Monitor *mon, const char *fdname); int monitor_get_fd(Monitor *mon, const char *fdname);
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap); void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
GCC_FMT_ATTR(2, 0);
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(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_print_filename(Monitor *mon, const char *filename);
void monitor_flush(Monitor *mon); void monitor_flush(Monitor *mon);

View File

@ -76,7 +76,8 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
void (*init)(struct CharDriverState *s)); void (*init)(struct CharDriverState *s));
CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)); CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
void qemu_chr_close(CharDriverState *chr); void qemu_chr_close(CharDriverState *chr);
void qemu_chr_printf(CharDriverState *s, const char *fmt, ...); void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len); int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
void qemu_chr_send_event(CharDriverState *s, int event); void qemu_chr_send_event(CharDriverState *s, int event);
void qemu_chr_add_handlers(CharDriverState *s, void qemu_chr_add_handlers(CharDriverState *s,

View File

@ -30,7 +30,7 @@ void loc_set_none(void);
void loc_set_cmdline(char **argv, int idx, int cnt); void loc_set_cmdline(char **argv, int idx, int cnt);
void loc_set_file(const char *fname, int lno); void loc_set_file(const char *fname, int lno);
void error_vprintf(const char *fmt, va_list ap); void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
void error_printf(const char *fmt, ...) GCC_FMT_ATTR(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_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
void error_print_loc(void); void error_print_loc(void);

View File

@ -39,7 +39,7 @@ typedef struct img_cmd_t {
/* Default to cache=writeback as data integrity is not important for qemu-tcg. */ /* Default to cache=writeback as data integrity is not important for qemu-tcg. */
#define BDRV_O_FLAGS BDRV_O_CACHE_WB #define BDRV_O_FLAGS BDRV_O_CACHE_WB
static void error(const char *fmt, ...) static void GCC_FMT_ATTR(1, 2) error(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -218,7 +218,8 @@ QError *qerror_new(void)
return qerr; return qerr;
} }
static void qerror_abort(const QError *qerr, const char *fmt, ...) static void GCC_FMT_ATTR(2, 3) qerror_abort(const QError *qerr,
const char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -233,7 +234,8 @@ static void qerror_abort(const QError *qerr, const char *fmt, ...)
abort(); abort();
} }
static void qerror_set_data(QError *qerr, const char *fmt, va_list *va) static void GCC_FMT_ATTR(2, 0) qerror_set_data(QError *qerr,
const char *fmt, va_list *va)
{ {
QObject *obj; QObject *obj;

View File

@ -34,7 +34,7 @@ typedef struct QError {
QError *qerror_new(void); QError *qerror_new(void);
QError *qerror_from_info(const char *file, int linenr, const char *func, QError *qerror_from_info(const char *file, int linenr, const char *func,
const char *fmt, va_list *va); const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
QString *qerror_human(const QError *qerror); QString *qerror_human(const QError *qerror);
void qerror_print(QError *qerror); void qerror_print(QError *qerror);
void qerror_report_internal(const char *file, int linenr, const char *func, void qerror_report_internal(const char *file, int linenr, const char *func,

View File

@ -18,9 +18,9 @@
#include "qobject.h" #include "qobject.h"
#include "qstring.h" #include "qstring.h"
QObject *qobject_from_json(const char *string); QObject *qobject_from_json(const char *string) GCC_FMT_ATTR(1, 0);
QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2);
QObject *qobject_from_jsonv(const char *string, va_list *ap); QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0);
QString *qobject_to_json(const QObject *obj); QString *qobject_to_json(const QObject *obj);

View File

@ -263,7 +263,7 @@ void if_start(struct ttys *);
long gethostid(void); long gethostid(void);
#endif #endif
void lprint(const char *, ...); void lprint(const char *, ...) GCC_FMT_ATTR(1, 2);
#ifndef _WIN32 #ifndef _WIN32
#include <netdb.h> #include <netdb.h>