]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUILD] add format(printf) to printf-like functions
authorWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2009 10:01:47 +0000 (12:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2009 10:01:47 +0000 (12:01 +0200)
Doing this helps catching warnings about wrong output formats.

include/proto/buffers.h
include/proto/log.h

index a8f536a75143bade3a64a4551833675fd3af69f8..dc9961a2bd97d4ab6f91bbb40c2f887aca82d93a 100644 (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);
 
 /*
index 4f6eed7f0af4e402cf3118642bf242623dc99715..f2ecf0b909b72e40b62b94fd378fa787eed0c121 100644 (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