[BUILD] add format(printf) to printf-like functions

Doing this helps catching warnings about wrong output formats.
This commit is contained in:
Willy Tarreau 2009-04-03 12:01:47 +02:00
parent 4076a15255
commit 40d2516371
2 changed files with 10 additions and 5 deletions

View File

@ -277,7 +277,8 @@ int buffer_write_chunk(struct buffer *buf, struct chunk *chunk);
int buffer_replace(struct buffer *b, char *pos, char *end, const char *str);
int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int len);
int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len);
int chunk_printf(struct chunk *chk, int size, const char *fmt, ...);
int chunk_printf(struct chunk *chk, int size, const char *fmt, ...)
__attribute__ ((format(printf, 3, 4)));
void buffer_dump(FILE *o, struct buffer *b, int from, int to);
/*

View File

@ -38,17 +38,20 @@ extern struct pool_head *pool2_requri;
* Displays the message on stderr with the date and pid. Overrides the quiet
* mode during startup.
*/
void Alert(const char *fmt, ...);
void Alert(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)));
/*
* Displays the message on stderr with the date and pid.
*/
void Warning(const char *fmt, ...);
void Warning(const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)));
/*
* Displays the message on <out> only if quiet mode is not set.
*/
void qfprintf(FILE *out, const char *fmt, ...);
void qfprintf(FILE *out, const char *fmt, ...)
__attribute__ ((format(printf, 2, 3)));
/*
* This function sends a syslog message to both log servers of a proxy,
@ -56,7 +59,8 @@ void qfprintf(FILE *out, const char *fmt, ...);
* It also tries not to waste too much time computing the message header.
* It doesn't care about errors nor does it report them.
*/
void send_log(struct proxy *p, int level, const char *message, ...);
void send_log(struct proxy *p, int level, const char *message, ...)
__attribute__ ((format(printf, 3, 4)));
/*
* send a log for the session when we have enough info about it