xfs
[Top] [All Lists]

[PATCH] repair: check repair message printflike arguments

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] repair: check repair message printflike arguments
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 16 Mar 2010 17:37:03 -0500
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
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 :(

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
---

diff --git a/repair/err_protos.h b/repair/err_protos.h
index 6944950..2e3bf97 100644
--- a/repair/err_protos.h
+++ b/repair/err_protos.h
@@ -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)));

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] repair: check repair message printflike arguments, Eric Sandeen <=