Skip to contentSkip to conversation

repair: check repair message printflike arguments

PATCH New Eric Sandeen 1 participant 1 message Mar 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 repair: check repair message printflike arguments

Unfortunately this lights up warnings like a christmas tree, but it does catch a few gems like:

scan.c:567: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘const char *’

passing a string to a %d :(

---

repair/err_protos.h +6 -4
index 6944950..2e3bf97 100644
@@ -17,10 +17,12 @@
  */
 
 /* abort, internal error */
-void  __attribute__((noreturn)) do_abort(char const *, ...);
+void do_abort(char const *, ...)
+	__attribute__((format (printf, 1, 2))) __attribute__((noreturn));
 /* abort, system error */
-void  __attribute__((noreturn)) do_error(char const *, ...);
+void do_error(char const *, ...) __attribute__((noreturn));
+	__attribute__((format (printf, 1, 2))) __attribute__((noreturn));
 /* issue warning */
-void do_warn(char const *, ...);
+void do_warn(char const *, ...) __attribute__ ((format (printf, 1, 2)));
 /* issue log message */
-void do_log(char const *, ...);
+void do_log(char const *, ...) __attribute__ ((format (printf, 1, 2)));

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs