Ignore:
Timestamp:
Jan 18, 2025, 3:46:06 PM (9 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
d0b6712
Parents:
fa59c40 (diff), df56e25 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/ctrl-flow/fallthrough.cfa

    rfa59c40 r8e90fd6  
    1010// Created On       : Wed Mar 14 10:06:25 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 24 11:24:35 2018
    13 // Update Count     : 22
     12// Last Modified On : Fri Jan 17 14:09:49 2025
     13// Update Count     : 23
    1414//
    1515
     
    2020          case 1:
    2121                sout | "case 1";
    22                 fallthru;
     22                fallthrough;
    2323          case 2:
    2424                sout | "case 2";
    25                 fallthru;
    26                 sout | "did not fallthru";
    27                 if ( 7 ) fallthru common2;
    28                 fallthru common1;
     25                fallthrough;
     26                sout | "did not fallthrough";
     27                if ( 7 ) fallthrough common2;
     28                fallthrough common1;
    2929          case 3:
    3030                sout | "case 3";
    31                 fallthru default;
    32                 fallthru common1;
     31                fallthrough default;
     32                fallthrough common1;
    3333          common1:
    3434                sout | "common1";
     
    3636          case 4:
    3737                sout | "case 4";
    38                 fallthru common2;
     38                fallthrough common2;
    3939          case 5:
    4040                sout | "case 5";
    41                 fallthru common2;
    42                 fallthru default;
     41                fallthrough common2;
     42                fallthrough default;
    4343          case 6:
    4444                sout | "case 6";
    45                 fallthru common2;
     45                fallthrough common2;
    4646          common2:
    4747                sout | "common2";
     
    4949          default:
    5050                sout | "default";
    51                 fallthru;
     51                fallthrough;
    5252        } // choose
    5353
     
    6262                        for ( int i = 0; i < 4; i += 1 ) {
    6363                                sout | i;
    64                                 if ( i == 2 ) fallthru common;
     64                                if ( i == 2 ) fallthrough common;
    6565                        } // for
    6666                } // switch
     
    7373                        } else {
    7474                                sout | "check";
    75                                 fallthru common;
     75                                fallthrough common;
    7676                        } // if
    7777                } // if
    7878          common:
    7979                sout | "common";
    80                 fallthru;
     80                fallthrough;
    8181                break;
    8282          default:
    8383                sout | "default";
    84                 fallthru;
     84                fallthrough;
    8585        } // switch
    8686
    8787#if ERR1
    8888        // ERROR: fallthrough must be enclosed in switch or choose
    89         fallthru;
     89        fallthrough;
    9090        // ERROR: fallthrough must be enclosed in switch or choose
    91         fallthru common4;
     91        fallthrough common4;
    9292        // ERROR: fallthrough must be enclosed in switch or choose
    93         fallthru default;
     93        fallthrough default;
    9494        choose ( 3 ) {
    9595          case 2:
     
    9898                          case 1:
    9999                                // ERROR: default is later, but in a different switch
    100                                 fallthru default;
     100                                fallthrough default;
    101101                                // ERROR: common3 is later, but not at the same level as a case clause
    102                                 fallthru common3;
     102                                fallthrough common3;
    103103                        }
    104104                  common3: ;
     
    108108          common4:
    109109                // ERROR: attempt to jump up with fallthrough
    110                 if ( 7 ) fallthru common4;
     110                if ( 7 ) fallthrough common4;
    111111                // ERROR: attempt to jump up with fallthrough
    112                 fallthru default;
     112                fallthrough default;
    113113        } // choose
    114114#endif
Note: See TracChangeset for help on using the changeset viewer.