Mark `help' and `version' functions as not returning.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 3 May 2020 15:16:18 +0000 (16:16 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 3 May 2020 15:16:18 +0000 (16:16 +0100)
They don't; and later versions of GCC complain about potential `switch'
fall-through mistakes without this.

Fixing this is a simple matter of adding `attribute((noreturn))' in the
right places.  Note that `server/gstdecode.c' doesn't share the common
attribute-macro machinery.

21 files changed:
clients/disorder.c
clients/disorderfm.c
clients/playrtp.c
clients/resample.c
clients/rtpmon.c
disobedience/disobedience.c
lib/version.h
libtests/test.c
server/choose.c
server/dbupgrade.c
server/deadlock.c
server/decode.c
server/disorderd.c
server/dump.c
server/gstdecode.c
server/normalize.c
server/rescan.c
server/speaker.c
server/stats.c
server/trackname.c
tests/udplog.c

index b9b2bb2..8fdbc60 100644 (file)
@@ -83,7 +83,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder [OPTIONS] COMMAND ...\n"
          "Options:\n"
@@ -498,7 +498,7 @@ static const struct option setup_guest_options[] = {
   { 0, 0, 0, 0 }
 };
 
-static void help_setup_guest(void) {
+static void attribute((noreturn)) help_setup_guest(void) {
   xprintf("Usage:\n"
          "  disorder setup-guest [OPTIONS]\n"
          "Options:\n"
@@ -844,7 +844,7 @@ static const struct client_command {
                       "Display the server version" },
 };
 
-static void help_commands(void) {
+static void attribute((noreturn)) help_commands(void) {
   unsigned n, max = 0, l;
 
   xprintf("Command summary:\n");
index 14092da..55aff3e 100644 (file)
@@ -102,7 +102,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
 "  disorderfm [OPTIONS] SOURCE DESTINATION\n"
 "Options:\n"
index f6e89d2..d28369f 100644 (file)
@@ -500,7 +500,7 @@ struct packet *playrtp_next_packet(void) {
 }
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-playrtp [OPTIONS] [[ADDRESS] PORT]\n"
          "Options:\n"
index 6291c83..f02cde7 100644 (file)
@@ -59,7 +59,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  resample [OPTIONS] < INPUT > OUTPUT\n"
          "Options:\n"
index 32974e8..21e451f 100644 (file)
@@ -77,7 +77,7 @@ static const struct option options[] = {
   { 0, 0, 0, 0 }
 };
 
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  rtpmon [OPTIONS] [ADDRESS] PORT\n"
          "Options:\n"
index d3e4d35..b988aa8 100644 (file)
@@ -472,7 +472,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Disobedience - GUI client for DisOrder\n"
           "\n"
           "Usage:\n"
index b8ee0d5..51a32a0 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef VERSION_H
 #define VERSION_H
 
-void version(const char *name);
+void attribute((noreturn)) version(const char *name);
 
 #endif /* VERSION_H */
 
index 3270d47..86a6184 100644 (file)
@@ -148,7 +148,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  %s [OPTIONS]\n"
          "Options:\n"
index 4b2d94f..ab24e2d 100644 (file)
@@ -42,7 +42,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-choose [OPTIONS]\n"
          "Options:\n"
index e44b7f5..220fb76 100644 (file)
@@ -48,7 +48,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-dbupgrade [OPTIONS]\n"
          "Options:\n"
index 636e382..fdc4f50 100644 (file)
@@ -34,7 +34,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-deadlock [OPTIONS]\n"
          "Options:\n"
index 8a09013..1b2ed41 100644 (file)
@@ -95,7 +95,7 @@ static const struct option options[] = {
 };
 
 /* Display usage message and terminate. */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-decode [OPTIONS] PATH\n"
          "Options:\n"
index 06651a1..a2ed421 100644 (file)
@@ -37,7 +37,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorderd [OPTIONS]\n"
          "Options:\n"
index 31e08af..85f9349 100644 (file)
@@ -40,7 +40,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-dump [OPTIONS] --dump|--undump PATH\n"
          "  disorder-dump [OPTIONS] --recompute-aliases\n"
index 42ccd7c..1f4d7a2 100644 (file)
 #include <gst/app/gstappsink.h>
 #include <gst/audio/audio.h>
 
-/* The only application we have for `attribute' is declaring function
+/* The only applications we have for `attribute' is declaring function
  * arguments as being unused, because we have a lot of callback functions
- * which are meant to comply with an externally defined interface.
+ * which are meant to comply with an externally defined interface; and
+ * marking `help' as not returning.
  */
 #ifdef __GNUC__
+#  define NORETURN __attribute__((noreturn))
 #  define UNUSED __attribute__((unused))
 #endif
 
@@ -533,7 +535,7 @@ static const struct option options[] = {
   { 0, 0, 0, 0 }
 };
 
-static void help(void)
+static void NORETURN help(void)
 {
   xprintf("Usage:\n"
           "  disorder-gstdecode [OPTIONS] PATH\n"
index 0f97a2f..6875094 100644 (file)
@@ -40,7 +40,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-normalize [OPTIONS]\n"
          "Options:\n"
index bd163b4..3a5a589 100644 (file)
@@ -39,7 +39,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-rescan [OPTIONS] [PATH...]\n"
          "Options:\n"
index a55b074..0cc3ac4 100644 (file)
@@ -235,7 +235,7 @@ static const struct option options[] = {
 };
 
 /* Display usage message and terminate. */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-speaker [OPTIONS]\n"
          "Options:\n"
index 1ac1cd7..ac37374 100644 (file)
@@ -36,7 +36,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-stats [OPTIONS]\n"
          "Options:\n"
index 2c62d0c..8deedd3 100644 (file)
@@ -29,7 +29,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  trackname [OPTIONS] TRACK CONTEXT PART\n"
          "Options:\n"
index 6c817ce..fe0b6ea 100644 (file)
@@ -49,7 +49,7 @@ static const struct option options[] = {
 };
 
 /* display usage message and terminate */
-static void help(void) {
+static void attribute((noreturn)) help(void) {
   xprintf("Usage:\n"
          "  disorder-udplog [OPTIONS] ADDRESS PORT\n"
          "Options:\n"
@@ -63,7 +63,7 @@ static void help(void) {
 }
 
 /* display version number and terminate */
-static void version(void) {
+static void attribute((noreturn)) version(void) {
   xprintf("%s", disorder_version_string);
   xfclose(stdout);
   exit(0);