chiark / gitweb /
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 b9b2bb2e9ffc16a92d1c872d509291d1be6ec96e..8fdbc60fb50fe2717b575d8755c9a7829a1374bc 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 14092dad74b1c9aa90d0586a6f237145d4ddb0d1..55aff3e4ba27ef9106f73e447f4deba46410f67e 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 f6e89d24391a95617bc056445c3ed1ce383a705b..d28369fb5b5293195c0e9bab73d81476957b6b10 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 6291c8336decc2798fd23e8b6a2b3c2cabcc28f7..f02cde71776ef761f7a1b2587dd58df7391acab3 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 32974e896c0e45a6680142230651c84b388e845f..21e451f6373478c59397ccd9eafaa181fc2d2148 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 d3e4d3523dc9dabc59788f3e8696990a31c8dc91..b988aa8855f362713b8be2b08118c1bc7d28da08 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 b8ee0d5a9a6ff0226e41ed63e286587be4553dca..51a32a088fa4511d0c6e5815e7295c68b70cf2d8 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 3270d470ab47e9d0393bf0925140136e5ff5bc7f..86a6184d5bed77fee55a89ae3a9866f30f1b4f9c 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 4b2d94fe0804989a3c491702d7355d4a75ddb4a4..ab24e2d5e797c083548b0ebde672aecab2ce6f48 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 e44b7f505b8089717d9e509babe5d6192cf06521..220fb767d51cef374ee75a092699ea23eaaeb83a 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 636e382e42a6dc9cc65f08644ee2431cf79ac9b6..fdc4f50fb17b8bed3e364824acdbb10408789c3f 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 8a09013b23666533acbe299859cd128c9fa43ff3..1b2ed4121135b0238503139edb0f017a27fb8a29 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 06651a1c54f47dfaa153cf2aca2b125ae9ff29bf..a2ed42188cabe01253b9ef3e28c44ab74cd65068 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 31e08afdb7789a59590970f0185624c4d02b6764..85f93497ab6318b2805c0e34fd09e981771f15cd 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 42ccd7c3982c049f4a84f186bcb48f088437d89d..1f4d7a2272df4eefbb30a589b6a18eccee78c8c4 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 0f97a2ff024a9d3360526af306828b3ad7767630..687509427ad8336dd26e7c705a4ff120b88c59a7 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 bd163b4b148726bf7afbb9e7bfa3f8be946dd3cb..3a5a5894fcf48f7165ea5f428c2f097d5a07c0e6 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 a55b074905828adf4cce6e0228743d809d9c283e..0cc3ac4ff589ed71319911dd455aeb46c8d9d536 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 1ac1cd7a037ff2534b07abbbb0901fe7d9408789..ac3737451875f396f3d1711c453fbe2fe9d21198 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 2c62d0ccfaa821120a48a6400f67ef3bf06073aa..8deedd30390b2ef91932deb3915e9265d79a172e 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 6c817ced7f3a1eb0e7927ffd72eab6616d660fe0..fe0b6eadb8d1ac654107e7bc67faa3ca0d39f632 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);