From ddb384f1ac7fbaed5a4dbb02ddc37d0713727be4 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sat, 22 Jun 2013 15:37:36 +0100 Subject: [PATCH] Use the new `mLib' annotations on varargs functions. Organization: Straylight/Edgeware From: Mark Wooding This caught a couple of bugs just fixed. --- client/tripectl.c | 5 +++-- common/util.h | 14 ++------------ priv/helper.c | 4 ++-- server/tripe.h | 11 ++++++----- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/client/tripectl.c b/client/tripectl.c index 438edf37..e5f086fd 100644 --- a/client/tripectl.c +++ b/client/tripectl.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,7 @@ static void checkbg(char **p) die(EXIT_FAILURE, "unexpected background tag `%s'", q); } -static void dolog(int prio, const char *msg, ...) +static void PRINTF_LIKE(2, 3) dolog(int prio, const char *msg, ...) { va_list ap; dstr d = DSTR_INIT; @@ -298,7 +299,7 @@ static void cleanup(void) { if (pidfile) unlink(pidfile); } static void sigdie(int sig) { cleanup(); signal(sig, SIG_DFL); raise(sig); } -static void putarg(string_v *av, const char *fmt, ...) +static void PRINTF_LIKE(2, 3) putarg(string_v *av, const char *fmt, ...) { va_list ap; dstr d = DSTR_INIT; diff --git a/common/util.h b/common/util.h index acdc0f6e..b4c45056 100644 --- a/common/util.h +++ b/common/util.h @@ -33,22 +33,12 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif -/*----- Macros ------------------------------------------------------------*/ - -/* --- @IGNORE@ --- * - * - * Arguments: @expr@ = an expression whose value is to be ignored - * - * Use: Ignores the value of an expression, even if compilers want - * us not to. - */ - -#define IGNORE(expr) do { if (expr) ; } while (0) - /*----- Functions provided ------------------------------------------------*/ /* --- @u_quotify@ --- * diff --git a/priv/helper.c b/priv/helper.c index 6e5834ac..f75f463c 100644 --- a/priv/helper.c +++ b/priv/helper.c @@ -62,7 +62,7 @@ static void lose(const char *excuse) #ifndef NTRACE -static void itrace(unsigned mask, const char *fmt, ...) +static void PRINTF_LIKE(2, 3) itrace(unsigned mask, const char *fmt, ...) { va_list ap; dstr d = DSTR_INIT; @@ -92,7 +92,7 @@ static void itrace(unsigned mask, const char *fmt, ...) #define A_END ((char *)0) -static void warn(const char *fmt, ...) +static void EXECL_LIKE(0) IGNORABLE warn(const char *fmt, ...) { va_list ap; dstr d = DSTR_INIT, dd = DSTR_INIT; diff --git a/server/tripe.h b/server/tripe.h index da073244..60256f74 100644 --- a/server/tripe.h +++ b/server/tripe.h @@ -942,7 +942,7 @@ extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list /*ap*/); * presentation. */ -extern void a_format(dstr */*d*/, const char */*fmt*/, ...); +extern void EXECL_LIKE(0) a_format(dstr */*d*/, const char */*fmt*/, ...); /* --- @a_warn@ --- * * @@ -954,7 +954,7 @@ extern void a_format(dstr */*d*/, const char */*fmt*/, ...); * Use: Informs all admin connections of a warning. */ -extern void a_warn(const char */*fmt*/, ...); +extern void EXECL_LIKE(0) a_warn(const char */*fmt*/, ...); /* --- @a_notify@ --- * * @@ -966,7 +966,7 @@ extern void a_warn(const char */*fmt*/, ...); * Use: Sends a notification to interested admin connections. */ -extern void a_notify(const char */*fmt*/, ...); +extern void EXECL_LIKE(0) a_notify(const char */*fmt*/, ...); /* --- @a_create@ --- * * @@ -1097,7 +1097,8 @@ extern void am_remove(addrmap */*m*/, void */*i*/); * Use: Writes a trace message. */ -T( extern void ps_trace(unsigned /*mask*/, const char */*fmt*/, ...); ) +T( extern void PRINTF_LIKE(2, 3) + ps_trace(unsigned /*mask*/, const char */*fmt*/, ...); ) /* --- @ps_warn@ --- * * @@ -1109,7 +1110,7 @@ T( extern void ps_trace(unsigned /*mask*/, const char */*fmt*/, ...); ) * Use: Writes a warning message. */ -extern void ps_warn(const char */*fmt*/, ...); +extern void PRINTF_LIKE(1, 2) ps_warn(const char */*fmt*/, ...); /* --- @ps_tunfd@ --- * * -- [mdw]