- File:
-
- 1 edited
-
tests/ctrl-flow/fallthrough.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/ctrl-flow/fallthrough.cfa
rd96f7c4 rb6923b17 10 10 // Created On : Wed Mar 14 10:06:25 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 17 14:09:49 202513 // Update Count : 2 312 // Last Modified On : Mon Dec 24 11:24:35 2018 13 // Update Count : 22 14 14 // 15 15 … … 20 20 case 1: 21 21 sout | "case 1"; 22 fallthr ough;22 fallthru; 23 23 case 2: 24 24 sout | "case 2"; 25 fallthr ough;26 sout | "did not fallthr ough";27 if ( 7 ) fallthr oughcommon2;28 fallthr oughcommon1;25 fallthru; 26 sout | "did not fallthru"; 27 if ( 7 ) fallthru common2; 28 fallthru common1; 29 29 case 3: 30 30 sout | "case 3"; 31 fallthr oughdefault;32 fallthr oughcommon1;31 fallthru default; 32 fallthru common1; 33 33 common1: 34 34 sout | "common1"; … … 36 36 case 4: 37 37 sout | "case 4"; 38 fallthr oughcommon2;38 fallthru common2; 39 39 case 5: 40 40 sout | "case 5"; 41 fallthr oughcommon2;42 fallthr oughdefault;41 fallthru common2; 42 fallthru default; 43 43 case 6: 44 44 sout | "case 6"; 45 fallthr oughcommon2;45 fallthru common2; 46 46 common2: 47 47 sout | "common2"; … … 49 49 default: 50 50 sout | "default"; 51 fallthr ough;51 fallthru; 52 52 } // choose 53 53 … … 62 62 for ( int i = 0; i < 4; i += 1 ) { 63 63 sout | i; 64 if ( i == 2 ) fallthr oughcommon;64 if ( i == 2 ) fallthru common; 65 65 } // for 66 66 } // switch … … 73 73 } else { 74 74 sout | "check"; 75 fallthr oughcommon;75 fallthru common; 76 76 } // if 77 77 } // if 78 78 common: 79 79 sout | "common"; 80 fallthr ough;80 fallthru; 81 81 break; 82 82 default: 83 83 sout | "default"; 84 fallthr ough;84 fallthru; 85 85 } // switch 86 86 87 87 #if ERR1 88 88 // ERROR: fallthrough must be enclosed in switch or choose 89 fallthr ough;89 fallthru; 90 90 // ERROR: fallthrough must be enclosed in switch or choose 91 fallthr oughcommon4;91 fallthru common4; 92 92 // ERROR: fallthrough must be enclosed in switch or choose 93 fallthr oughdefault;93 fallthru default; 94 94 choose ( 3 ) { 95 95 case 2: … … 98 98 case 1: 99 99 // ERROR: default is later, but in a different switch 100 fallthr oughdefault;100 fallthru default; 101 101 // ERROR: common3 is later, but not at the same level as a case clause 102 fallthr oughcommon3;102 fallthru common3; 103 103 } 104 104 common3: ; … … 108 108 common4: 109 109 // ERROR: attempt to jump up with fallthrough 110 if ( 7 ) fallthr oughcommon4;110 if ( 7 ) fallthru common4; 111 111 // ERROR: attempt to jump up with fallthrough 112 fallthr oughdefault;112 fallthru default; 113 113 } // choose 114 114 #endif
Note:
See TracChangeset
for help on using the changeset viewer.