From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs mailing list <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfsprogs: fix up the noreturn annotations
Date: Wed, 09 Sep 2009 12:16:14 -0500 [thread overview]
Message-ID: <4AA7E2DE.9090402@sandeen.net> (raw)
In-Reply-To: <20090908143956.GA15533@infradead.org>
Christoph Hellwig wrote:
> The usage function in mkfs needs a noreturn annotation too, otherwise
> gcc will complain, similarly the do_msg function in repair would need
> it if do_abort is set, but because conditional annotations aren't
> possible just clean this area up an inline the do_msg function into
> it's callers.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
> Index: xfsprogs-dev/mkfs/xfs_mkfs.c
> ===================================================================
> --- xfsprogs-dev.orig/mkfs/xfs_mkfs.c 2009-09-08 11:33:17.892004074 -0300
> +++ xfsprogs-dev/mkfs/xfs_mkfs.c 2009-09-08 11:33:26.993004077 -0300
> @@ -27,6 +27,7 @@
> */
> static void conflict(char opt, char *tab[], int oldidx, int newidx);
> static void illegal(char *value, char *opt);
> +static __attribute__((noreturn)) void usage (void);
> 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);
> @@ -2554,7 +2555,7 @@ cvtnum(
> return -1LL;
> }
>
> -void
> +static void __attribute__((noreturn))
> usage( void )
> {
> fprintf(stderr, _("Usage: %s\n\
> Index: xfsprogs-dev/mkfs/xfs_mkfs.h
> ===================================================================
> --- xfsprogs-dev.orig/mkfs/xfs_mkfs.h 2009-09-08 11:33:17.904015867 -0300
> +++ xfsprogs-dev/mkfs/xfs_mkfs.h 2009-09-08 11:33:26.993004077 -0300
> @@ -68,7 +68,6 @@
>
>
> /* xfs_mkfs.c */
> -extern void usage (void);
> extern int isdigits (char *str);
> extern long long cvtnum (unsigned int blocksize,
> unsigned int sectorsize, char *s);
> Index: xfsprogs-dev/repair/xfs_repair.c
> ===================================================================
> --- xfsprogs-dev.orig/repair/xfs_repair.c 2009-09-08 11:33:31.211278768 -0300
> +++ xfsprogs-dev/repair/xfs_repair.c 2009-09-08 11:34:30.158256533 -0300
> @@ -339,18 +339,6 @@ process_args(int argc, char **argv)
> usage();
> }
>
> -void
> -do_msg(int do_abort, char const *msg, va_list args)
> -{
> - vfprintf(stderr, msg, args);
> -
> - if (do_abort) {
> - if (dumpcore)
> - abort();
> - exit(1);
> - }
> -}
> -
> void __attribute__((noreturn))
> do_error(char const *msg, ...)
> {
> @@ -359,7 +347,10 @@ do_error(char const *msg, ...)
> fprintf(stderr, _("\nfatal error -- "));
>
> va_start(args, msg);
> - do_msg(1, msg, args);
> + vfprintf(stderr, msg, args);
> + if (dumpcore)
> + abort();
> + exit(1);
> }
>
> /*
> @@ -372,7 +363,10 @@ do_abort(char const *msg, ...)
> va_list args;
>
> va_start(args, msg);
> - do_msg(1, msg, args);
> + vfprintf(stderr, msg, args);
> + if (dumpcore)
> + abort();
> + exit(1);
> }
>
> void
> @@ -383,7 +377,7 @@ do_warn(char const *msg, ...)
> fs_is_dirty = 1;
>
> va_start(args, msg);
> - do_msg(0, msg, args);
> + vfprintf(stderr, msg, args);
> va_end(args);
> }
>
> @@ -395,7 +389,7 @@ do_log(char const *msg, ...)
> va_list args;
>
> va_start(args, msg);
> - do_msg(0, msg, args);
> + vfprintf(stderr, msg, args);
> va_end(args);
> }
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2009-09-09 17:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 22:35 [PATCH] xfsprogs: mark some functions as noreturn Eric Sandeen
2009-09-04 23:09 ` Christoph Hellwig
2009-09-08 14:39 ` [PATCH] xfsprogs: fix up the noreturn annotations Christoph Hellwig
2009-09-09 17:16 ` Eric Sandeen [this message]
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=4AA7E2DE.9090402@sandeen.net \
--to=sandeen@sandeen.net \
--cc=hch@infradead.org \
--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