chiark / gitweb /
Use the new `mLib' annotations on varargs functions.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 22 Jun 2013 14:37:36 +0000 (15:37 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 12 Jul 2013 09:38:56 +0000 (10:38 +0100)
This caught a couple of bugs just fixed.

client/tripectl.c
common/util.h
priv/helper.c
server/tripe.h

index 438edf376bf6dad65915e2eaf25a0c4655d14a0f..e5f086fdc5cee05d7ed9aba49731ea7f73510258 100644 (file)
@@ -52,6 +52,7 @@
 #include <mLib/daemonize.h>
 #include <mLib/darray.h>
 #include <mLib/dstr.h>
 #include <mLib/daemonize.h>
 #include <mLib/darray.h>
 #include <mLib/dstr.h>
+#include <mLib/macros.h>
 #include <mLib/mdup.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
 #include <mLib/mdup.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
@@ -122,7 +123,7 @@ static void checkbg(char **p)
     die(EXIT_FAILURE, "unexpected background tag `%s'", q);
 }
 
     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;
 {
   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 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;
 {
   va_list ap;
   dstr d = DSTR_INIT;
index acdc0f6e909d79664321620ee2434fa48ccc2d5c..b4c45056ace6b2a8001d7ac142f9f4038a6c41d5 100644 (file)
 
 #include <sys/types.h>
 
 
 #include <sys/types.h>
 
+#include <mLib/macros.h>
+
 #ifdef __cplusplus
   extern "C" {
 #endif
 
 #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@ --- *
 /*----- Functions provided ------------------------------------------------*/
 
 /* --- @u_quotify@ --- *
index 6e5834ac21562b490743199d56f0a5bab1c69ab1..f75f463c8d85378d4dabc85f6218c7ff9476fe9d 100644 (file)
@@ -62,7 +62,7 @@ static void lose(const char *excuse)
 
 #ifndef NTRACE
 
 
 #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;
 {
   va_list ap;
   dstr d = DSTR_INIT;
@@ -92,7 +92,7 @@ static void itrace(unsigned mask, const char *fmt, ...)
 
 #define A_END ((char *)0)
 
 
 #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;
 {
   va_list ap;
   dstr d = DSTR_INIT, dd = DSTR_INIT;
index da0732446cf518592582cad676b1f62181879247..60256f741e9c94a2c5faa4cba51eeaf0367d3270 100644 (file)
@@ -942,7 +942,7 @@ extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list /*ap*/);
  *             presentation.
  */
 
  *             presentation.
  */
 
-extern void a_format(dstr */*d*/, const char */*fmt*/, ...);
+extern void EXECL_LIKE(0) a_format(dstr */*d*/, const char */*fmt*/, ...);
 
 /* --- @a_warn@ --- *
  *
 
 /* --- @a_warn@ --- *
  *
@@ -954,7 +954,7 @@ extern void a_format(dstr */*d*/, const char */*fmt*/, ...);
  * Use:                Informs all admin connections of a warning.
  */
 
  * 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@ --- *
  *
 
 /* --- @a_notify@ --- *
  *
@@ -966,7 +966,7 @@ extern void a_warn(const char */*fmt*/, ...);
  * Use:                Sends a notification to interested admin connections.
  */
 
  * 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@ --- *
  *
 
 /* --- @a_create@ --- *
  *
@@ -1097,7 +1097,8 @@ extern void am_remove(addrmap */*m*/, void */*i*/);
  * Use:                Writes a trace message.
  */
 
  * 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@ --- *
  *
 
 /* --- @ps_warn@ --- *
  *
@@ -1109,7 +1110,7 @@ T( extern void ps_trace(unsigned /*mask*/, const char */*fmt*/, ...); )
  * Use:                Writes a warning message.
  */
 
  * 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@ --- *
  *
 
 /* --- @ps_tunfd@ --- *
  *