Add format attributes for the printf-like custom error functions in
util.c.

ok?

Index: config.h
===================================================================
RCS file: /var/cvs/src/usr.sbin/config/config.h,v
retrieving revision 1.28
diff -u -p -r1.28 config.h
--- config.h    16 Jan 2015 06:40:16 -0000      1.28
+++ config.h    15 Oct 2016 10:54:37 -0000
@@ -368,9 +368,12 @@ void       *emalloc(size_t);
 void   *ereallocarray(void *, size_t, size_t);
 void   *ecalloc(size_t, size_t);
 char   *sourcepath(const char *);
-void   error(const char *, ...);                       /* immediate errs */
-void   xerror(const char *, int, const char *, ...);   /* delayed errs */
-__dead void panic(const char *, ...);
+void   error(const char *, ...)                        /* immediate errs */
+               __attribute__((__format__ (printf, 1, 2)));
+void   xerror(const char *, int, const char *, ...)    /* delayed errs */
+               __attribute__((__format__ (printf, 3, 4)));
+__dead void panic(const char *, ...)
+               __attribute__((__format__ (printf, 1, 2)));
 struct nvlist *newnv(const char *, const char *, void *, int, struct nvlist *);
 void   nvfree(struct nvlist *);
 void   nvfreel(struct nvlist *);
Index: util.c
===================================================================
RCS file: /var/cvs/src/usr.sbin/config/util.c,v
retrieving revision 1.17
diff -u -p -r1.17 util.c
--- util.c      7 Sep 2016 18:36:52 -0000       1.17
+++ util.c      15 Oct 2016 11:11:35 -0000
@@ -52,7 +52,8 @@
 
 #include "config.h"
 
-static void vxerror(const char *, int, const char *, va_list);
+static void vxerror(const char *, int, const char *, va_list)
+               __attribute__((__format__ (printf, 3, 0)));
 
 /*
  * Malloc, with abort on error.

Reply via email to