changeset 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -0400
parents bb115deb6fb2
children 5581ef01f993
files anagram/agcore/engine.cgs doc/misc/whatsnew.html
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/anagram/agcore/engine.cgs	Mon Jun 13 00:02:15 2022 -0400
+++ b/anagram/agcore/engine.cgs	Mon Jun 13 00:04:38 2022 -0400
@@ -676,6 +676,7 @@
           return;
         }
       } while (ag_look_ahead(PCBARG) == ag_ch);
+      /* FALLTHROUGH */
     case ag_no_match_key:
 ag_fail:
       (PCB).rx = save_index;
@@ -692,6 +693,7 @@
     case ag_set_key:
       save_index = (PCB).rx;
       (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
+      /* FALLTHROUGH */
     case ag_jmp_key:
       ag_k = ag_key_jmp[ag_k];
       ag_ch = ag_look_ahead(PCBARG);
@@ -884,6 +886,7 @@
         }
       } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
     }
+    /* FALLTHROUGH */
     case ag_no_match_key:
 ag_fail:
       (PCB).la_ptr = (PCB).pointer + ag_save;
@@ -900,6 +903,7 @@
     case ag_set_key:
       ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
       (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
+      /* FALLTHROUGH */
     case ag_jmp_key:
       ag_k = ag_key_jmp[ag_k];
       break;
@@ -2507,6 +2511,7 @@
         case ag_set_key:
           (PCB).save_index = (PCB).rx;
           (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[(PCB).key_state];
+          /* FALLTHROUGH */
         case ag_jmp_key:
           (PCB).key_state = ag_key_jmp[(PCB).key_state];
           continue;
--- a/doc/misc/whatsnew.html	Mon Jun 13 00:02:15 2022 -0400
+++ b/doc/misc/whatsnew.html	Mon Jun 13 00:04:38 2022 -0400
@@ -113,6 +113,13 @@
 </P>
 
 <P>
+<B>Engine compiler warnings.</B> The code generated by AnaGram
+includes several <TT>switch</TT> cases that intentionally fall
+through. These now include explicit <TT>FALLTHROUGH</TT> annotations
+to satisfy current compilers.
+</P>
+
+<P>
 <B>Multiple output header files.</B> Including more than one AnaGram
 output header file at once used to cause some compilers to issue a
 warning, because an <TT>#ifndef</TT> directive was checking the wrong