comparison anagram/agcore/engine.cgs @ 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 13d2b8934445
children
comparison
equal deleted inserted replaced
20:bb115deb6fb2 21:1c9dac05d040
674 if ((ag_ch = *sp++) == 0) { 674 if ((ag_ch = *sp++) == 0) {
675 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k]; 675 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
676 return; 676 return;
677 } 677 }
678 } while (ag_look_ahead(PCBARG) == ag_ch); 678 } while (ag_look_ahead(PCBARG) == ag_ch);
679 /* FALLTHROUGH */
679 case ag_no_match_key: 680 case ag_no_match_key:
680 ag_fail: 681 ag_fail:
681 (PCB).rx = save_index; 682 (PCB).rx = save_index;
682 return; 683 return;
683 case ag_cf_set_key: { 684 case ag_cf_set_key: {
690 break; 691 break;
691 } 692 }
692 case ag_set_key: 693 case ag_set_key:
693 save_index = (PCB).rx; 694 save_index = (PCB).rx;
694 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k]; 695 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
696 /* FALLTHROUGH */
695 case ag_jmp_key: 697 case ag_jmp_key:
696 ag_k = ag_key_jmp[ag_k]; 698 ag_k = ag_key_jmp[ag_k];
697 ag_ch = ag_look_ahead(PCBARG); 699 ag_ch = ag_look_ahead(PCBARG);
698 break; 700 break;
699 case ag_accept_key: 701 case ag_accept_key:
882 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k]; 884 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
883 return; 885 return;
884 } 886 }
885 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); 887 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
886 } 888 }
889 /* FALLTHROUGH */
887 case ag_no_match_key: 890 case ag_no_match_key:
888 ag_fail: 891 ag_fail:
889 (PCB).la_ptr = (PCB).pointer + ag_save; 892 (PCB).la_ptr = (PCB).pointer + ag_save;
890 return; 893 return;
891 case ag_cf_set_key: { 894 case ag_cf_set_key: {
898 break; 901 break;
899 } 902 }
900 case ag_set_key: 903 case ag_set_key:
901 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); 904 ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
902 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k]; 905 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
906 /* FALLTHROUGH */
903 case ag_jmp_key: 907 case ag_jmp_key:
904 ag_k = ag_key_jmp[ag_k]; 908 ag_k = ag_key_jmp[ag_k];
905 break; 909 break;
906 case ag_accept_key: 910 case ag_accept_key:
907 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k]; 911 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[ag_k];
2505 continue; 2509 continue;
2506 } 2510 }
2507 case ag_set_key: 2511 case ag_set_key:
2508 (PCB).save_index = (PCB).rx; 2512 (PCB).save_index = (PCB).rx;
2509 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[(PCB).key_state]; 2513 (PCB).token_number = (AG_TOKEN_TYPE) ag_key_parm[(PCB).key_state];
2514 /* FALLTHROUGH */
2510 case ag_jmp_key: 2515 case ag_jmp_key:
2511 (PCB).key_state = ag_key_jmp[(PCB).key_state]; 2516 (PCB).key_state = ag_key_jmp[(PCB).key_state];
2512 continue; 2517 continue;
2513 case ag_cf_end_key: 2518 case ag_cf_end_key:
2514 case ag_end_key: 2519 case ag_end_key: