public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs mailing list <xfs@oss.sgi.com>
Subject: [PATCH] xfsprogs: mark some functions as noreturn
Date: Fri, 04 Sep 2009 17:35:37 -0500	[thread overview]
Message-ID: <4AA19639.6090208@sandeen.net> (raw)

Static checkers are a lot less noisy if they know certain
functions are noreturn.

Making this change removed about 50 errors from "clang" output.
(http://clang-analyzer.llvm.org) output.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 69d91c5..ab8a7d9 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -27,7 +27,7 @@
  */
 static void conflict(char opt, char *tab[], int oldidx, int newidx);
 static void illegal(char *value, char *opt);
-static void reqval(char opt, char *tab[], int idx);
+static __attribute__((noreturn)) void reqval(char opt, char *tab[], int idx);
 static void respec(char opt, char *tab[], int idx);
 static void unknown(char opt, char *s);
 static int  ispow2(unsigned int i);
@@ -2464,7 +2464,7 @@ ispow2(
 	return (i & (i - 1)) == 0;
 }
 
-static void
+static void __attribute__((noreturn))
 reqval(
 	char		opt,
 	char		*tab[],
diff --git a/repair/err_protos.h b/repair/err_protos.h
index 556e9b9..6944950 100644
--- a/repair/err_protos.h
+++ b/repair/err_protos.h
@@ -16,7 +16,11 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-void	do_abort(char const *, ...);		/* abort, internal error */
-void	do_error(char const *, ...);		/* abort, system error */
-void	do_warn(char const *, ...);		/* issue warning */
-void	do_log(char const *, ...);		/* issue log message */
+/* abort, internal error */
+void  __attribute__((noreturn)) do_abort(char const *, ...);
+/* abort, system error */
+void  __attribute__((noreturn)) do_error(char const *, ...);
+/* issue warning */
+void do_warn(char const *, ...);
+/* issue log message */
+void do_log(char const *, ...);
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index e9e5965..5dfc3c3 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -351,7 +351,7 @@ do_msg(int do_abort, char const *msg, va_list args)
 	}
 }
 
-void
+void __attribute__((noreturn))
 do_error(char const *msg, ...)
 {
 	va_list args;
@@ -366,7 +366,7 @@ do_error(char const *msg, ...)
  * like do_error, only the error is internal, no system
  * error so no oserror processing
  */
-void
+void __attribute__((noreturn))
 do_abort(char const *msg, ...)
 {
 	va_list args;

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

             reply	other threads:[~2009-09-04 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04 22:35 Eric Sandeen [this message]
2009-09-04 23:09 ` [PATCH] xfsprogs: mark some functions as noreturn Christoph Hellwig
2009-09-08 14:39 ` [PATCH] xfsprogs: fix up the noreturn annotations Christoph Hellwig
2009-09-09 17:16   ` Eric Sandeen

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=4AA19639.6090208@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox