The assert function doesn't always cause the program to exit, so it
can't be marked _Noreturn. Therefore, even affirm (false), when it
expands to assert (false), will warn about an implicit fallthrough.

* src/cut.c (main): Move the affirm (false) case to the end of the
switch statement.
* src/numfmt.c (simple_strtod_fatal): Likewise.
* src/tr.c (string2_extend): Remove the call to unreachable () default
and combine it with the affirm (false) case.
---
 src/cut.c    | 6 +++---
 src/numfmt.c | 9 ++++-----
 src/tr.c     | 5 +----
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/cut.c b/src/cut.c
index cc85a6927..59b213f39 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -1438,9 +1438,6 @@ main (int argc, char **argv)
   void (*cut_stream) (FILE *) = NULL;
   switch (cut_mode)
     {
-    case CUT_MODE_NONE:
-      affirm (false);
-
     case CUT_MODE_BYTES:
       cut_stream = MB_CUR_MAX <= 1 || !no_split
                    ? cut_bytes : cut_bytes_no_split;
@@ -1455,6 +1452,9 @@ main (int argc, char **argv)
                    : bytesearch_field_delim_ok () ? cut_fields_bytesearch
                    : cut_fields_mb;
       break;
+
+    case CUT_MODE_NONE:
+      affirm (false);
     }
   affirm (cut_stream);
   if (optind == argc)
diff --git a/src/numfmt.c b/src/numfmt.c
index 79feaf2f8..cdb1af472 100644
--- a/src/numfmt.c
+++ b/src/numfmt.c
@@ -741,11 +741,6 @@ simple_strtod_fatal (enum simple_strtod_error err, char 
const *input_str)
 
   switch (err)
     {
-    case SSE_OK_PRECISION_LOSS:
-    case SSE_OK:
-      /* should never happen - this function isn't called when OK.  */
-      affirm (false);
-
     case SSE_OVERFLOW:
       msgid = N_("value too large to be converted: %s");
       break;
@@ -766,6 +761,10 @@ simple_strtod_fatal (enum simple_strtod_error err, char 
const *input_str)
       msgid = N_("missing 'i' suffix in input: %s (e.g Ki/Mi/Gi)");
       break;
 
+    case SSE_OK_PRECISION_LOSS:
+    case SSE_OK:
+      /* should never happen - this function isn't called when OK.  */
+      affirm (false);
     }
 
   if (inval_style != inval_ignore)
diff --git a/src/tr.c b/src/tr.c
index 528bee7e9..7d32257d6 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1397,13 +1397,10 @@ string2_extend (const struct Spec_list *s1, struct 
Spec_list *s2)
       char_to_repeat = p->u.repeated_char.the_repeated_char;
       break;
 
-    case RE_EQUIV_CLASS:
+    case RE_EQUIV_CLASS: default:
       /* This shouldn't happen, because validate exits with an error
          if it finds an equiv class in string2 when translating.  */
       affirm (false);
-
-    default:
-      unreachable ();
     }
 
   append_repeated_char (s2, char_to_repeat, s1->length - s2->length);
-- 
2.55.0


Reply via email to