]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: fix up the noreturn annotations
authorChristoph Hellwig <hch@infradead.org>
Thu, 10 Sep 2009 21:20:29 +0000 (16:20 -0500)
committerAlex Elder <aelder@sgi.com>
Thu, 10 Sep 2009 21:20:29 +0000 (16:20 -0500)
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 and inline the do_msg function into
it's callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Alex Elder <aelder@sgi.com>
mkfs/xfs_mkfs.c
mkfs/xfs_mkfs.h
repair/xfs_repair.c

index ab8a7d9e7d020b64e83e8308f8e87cd931c3ccbb..53eccbd901391338ba58ef858c0af6b554f63f80 100644 (file)
@@ -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 296da9e9d9a32973c8a2923e0a3921106e2645a6..49401d61d9d97bfddd8b82894143741571859c4d 100644 (file)
@@ -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 5dfc3c3e237fed761ff7be716045f1e2498dbbce..8bf20bbfde1e823d1981ad55a8e6642e8b7f167a 100644 (file)
@@ -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);
 }