]> birchwood-abbey.net Git - mit-scheme.git/commitdiff
Define and use FALLTHROUGH() macro to pacify clang.
authorTaylor R Campbell <campbell+mit-scheme@mumble.net>
Thu, 31 Dec 2020 18:18:07 +0000 (18:18 +0000)
committerTaylor R Campbell <campbell+mit-scheme@mumble.net>
Thu, 31 Dec 2020 18:34:56 +0000 (18:34 +0000)
(cherry picked from commit 4c55717b7d6b38c1aaaf51b95beff879b9ffd7ae)

src/microcode/confshared.h
src/microcode/interp.c
src/microcode/syntax.c
src/microcode/ux.c
src/microcode/uxsig.c

index 4861c7a23ba2e3d7ef267e8289192537eb39f203..502d1b16325f73af6f8109c464a4bdb5fa805148 100644 (file)
@@ -149,6 +149,13 @@ USA.
 #  define ATTRIBUTE(x)
 #  define NORETURN
 #endif
+
+#if (((defined (__GNUC__)) && (__GNUC__ >= 7)) || \
+       ((defined (__clang__)) && (__clang_major__ >= 12)))
+#  define FALLTHROUGH() ATTRIBUTE ((__fallthrough__))
+#else
+#  define FALLTHROUGH() ((void)0)
+#endif
 \f
 /* Operating System / Machine dependencies:
 
index 9ee54de36ff089bd6d3ce3b9558b999178e3bd5a..492f415b1aa4af2ce67d576c56e3e08c595f6bb0 100644 (file)
@@ -827,8 +827,7 @@ Interpret (void)
     internal_apply_val:
 
       (APPLY_FRAME_PROCEDURE ()) = GET_VAL;
-      /* fall through */
-
+      FALLTHROUGH ();
     case RC_INTERNAL_APPLY:
     internal_apply:
 
index b42bac46a59a143a2c677db7772e3204aee7ba34..8fdafdb8e41841967c2d255ccc40b7371c21ca93 100644 (file)
@@ -507,8 +507,7 @@ DEFINE_PRIMITIVE ("SCAN-LIST-FORWARD", Prim_scan_list_forward, 7, 7, 0)
        case syntaxcode_charquote:
          LOSE_IF_RIGHT_END (start);
          MOVE_RIGHT (start);
-         /* fall through */
-
+         FALLTHROUGH ();
        case syntaxcode_word:
        case syntaxcode_symbol:
          if ((depth != 0) || (! sexp_flag))
@@ -522,8 +521,7 @@ DEFINE_PRIMITIVE ("SCAN-LIST-FORWARD", Prim_scan_list_forward, 7, 7, 0)
                case syntaxcode_charquote:
                  MOVE_RIGHT (start);
                  LOSE_IF_RIGHT_END (start);
-                 /* fall through */
-
+                 FALLTHROUGH ();
                case syntaxcode_word:
                case syntaxcode_symbol:
                  MOVE_RIGHT (start);
@@ -978,8 +976,7 @@ DEFINE_PRIMITIVE ("SCAN-SEXPS-FORWARD", Prim_scan_sexps_forward, 7, 7, 0)
                      quoted = true;
                      DONE_IF (true);
                    }
-                 /* fall through */
-
+                 FALLTHROUGH ();
                case syntaxcode_word:
                case syntaxcode_symbol:
                  MOVE_RIGHT (start);
index 9498a836956313246b492f9145d65da3806c571f..72467df58f224309ef2b09bd8ec0e638d2e13df5 100644 (file)
@@ -58,8 +58,7 @@ UX_prim_check_fd_errno (enum syscall_names name)
          REQUEST_GC (0);
          deliver_pending_interrupts ();
        }
-      /* Fall through */
-
+      FALLTHROUGH ();
     default:
       error_system_call (errno, name);
     }
index dbde9a46fb3d681648a7f643ce057e98b374b3ac..75e5e9cf379b4555b564e0c4375c249510bd6d45 100644 (file)
@@ -856,7 +856,7 @@ interactive_interrupt_handler (SIGCONTEXT_T * scp)
            fprintf (stderr, "Problems reading keyboard input -- Exitting.\n");
            termination_eof ();
          }
-         /* fall through */
+         FALLTHROUGH ();
        default:
          if (!option_emacs_subprocess)
            print_interactive_help ();
@@ -987,7 +987,7 @@ describe_sighnd (int signo, unsigned char c)
            case dfl_terminate: goto describe_terminate;
            }
       }
-      /* fall through */
+      FALLTHROUGH ();
     default:
       fputs ("When typed, this character will have an unknown effect.\n",
             stdout);
@@ -1084,6 +1084,7 @@ reset_query (SIGCONTEXT_T * scp)
          CLEAR_CRITICAL_SECTION_HOOK ();
          EXIT_CRITICAL_SECTION ({});
          hard_reset (scp);
+         FALLTHROUGH ();
        case 'P':
        default:
          return;