All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] repair: check repair message printflike arguments
Date: Tue, 16 Mar 2010 17:37:03 -0500	[thread overview]
Message-ID: <4BA0080F.4030608@sandeen.net> (raw)

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@sandeen.net>
---

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)));

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2010-03-16 22:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA0080F.4030608@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.