Gcc and clang can check format strings of printf-like functions
Since we don't support any other compilers right now, enable that
extension unconditionally.
Fix the bugs found by format string checking.
Corresponding to flashrom svn r1032.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
diff --git a/flash.h b/flash.h
index 84ee511..cf3bd21 100644
--- a/flash.h
+++ b/flash.h
@@ -591,7 +591,8 @@
#define NT 1 /* Not tested */
/* cli_output.c */
-int print(int type, const char *fmt, ...);
+/* Let gcc and clang check for correct printf-style format strings. */
+int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#define MSG_ERROR 0
#define MSG_INFO 1
#define MSG_DEBUG 2