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