From 62451b58c98e97d6b4feb47ecabb3bf904714a4b Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 14 Mar 2012 23:47:19 +0000 Subject: [PATCH] Add BOZO_PRINTFLIKE for functions that pass an argument and va_arg to a vprintf-like function. --- libexec/httpd/bozohttpd.h | 19 +++++++++---------- libexec/httpd/ssl-bozo.c | 6 +++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/libexec/httpd/bozohttpd.h b/libexec/httpd/bozohttpd.h index 44baf4b79c9f..bad55a512b10 100644 --- a/libexec/httpd/bozohttpd.h +++ b/libexec/httpd/bozohttpd.h @@ -1,4 +1,4 @@ -/* $NetBSD: bozohttpd.h,v 1.21 2012/02/20 09:26:56 elric Exp $ */ +/* $NetBSD: bozohttpd.h,v 1.22 2012/03/14 23:47:19 joerg Exp $ */ /* $eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $ */ @@ -164,19 +164,18 @@ typedef struct bozoprefs_t { #define strornull(x) ((x) ? (x) : "") -#ifndef NO_DEBUG -void debug__(bozohttpd_t *, int, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); -#define debug(x) debug__ x -#else -#define debug(x) -#endif /* NO_DEBUG */ - #if defined(__GNUC__) && __GNUC__ >= 3 #define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y))) #define BOZO_DEAD __attribute__((__noreturn__)) #endif +#ifndef NO_DEBUG +void debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4); +#define debug(x) debug__ x +#else +#define debug(x) +#endif /* NO_DEBUG */ + void bozo_warn(bozohttpd_t *, const char *, ...) BOZO_PRINTFLIKE(2, 3); void bozo_err(bozohttpd_t *, int, const char *, ...) @@ -278,7 +277,7 @@ void bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *, const #endif /* I/O */ -int bozo_printf(bozohttpd_t *, const char *, ...); +int bozo_printf(bozohttpd_t *, const char *, ...) BOZO_PRINTFLIKE(2, 3);; ssize_t bozo_read(bozohttpd_t *, int, void *, size_t); ssize_t bozo_write(bozohttpd_t *, int, const void *, size_t); int bozo_flush(bozohttpd_t *, FILE *); diff --git a/libexec/httpd/ssl-bozo.c b/libexec/httpd/ssl-bozo.c index 96e12895de40..0d52f4d9d29d 100644 --- a/libexec/httpd/ssl-bozo.c +++ b/libexec/httpd/ssl-bozo.c @@ -1,4 +1,4 @@ -/* $NetBSD: ssl-bozo.c,v 1.14 2012/02/20 08:40:46 elric Exp $ */ +/* $NetBSD: ssl-bozo.c,v 1.15 2012/03/14 23:47:19 joerg Exp $ */ /* $eterna: ssl-bozo.c,v 1.15 2011/11/18 09:21:15 mrg Exp $ */ @@ -64,7 +64,7 @@ typedef struct sslinfo_t { * the error provided by the caller at the point of error it pops and * prints all errors from the SSL error queue. */ -BOZO_DEAD static void +BOZO_PRINTFLIKE(3, 4) BOZO_DEAD static void bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...) { va_list ap; @@ -96,7 +96,7 @@ bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...) exit(code); } -static int +static BOZO_PRINTFLIKE(2, 0) int bozo_ssl_printf(bozohttpd_t *httpd, const char * fmt, va_list ap) { sslinfo_t *sslinfo;