- Timestamp:
- Jul 12, 2016, 6:34:10 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- e4d3ceb
- Parents:
- 6e4b913
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/switch.c
r6e4b913 r4e06c1e 1 int main(int argc, char const *argv[]) { 2 int i; 3 switch ( i ) case 3 : i = 1; 4 switch ( i ) default : i = 1; 5 switch ( 3 ) 6 default: 7 case 2: 8 case 3: 9 3; 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // switch.c -- 8 // 9 // Author : Peter A. Buhr 10 // Created On : Tue Jul 12 06:50:22 2016 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 18:02:23 2016 13 // Update Count : 22 14 // 10 15 11 switch ( i ) { 12 } 16 int f( int i ) { return i; } 13 17 14 switch ( i ) { 15 int i; 16 case 8~10: 17 default: 18 i = 3; 19 case 3: 20 case 'A' ... 'Z': 21 case 5 ... 6: 22 case 2, 4: 23 i = 3; 24 break; 25 } 18 int main() { 19 int i = 0; 20 switch ( i ) case 3 : i = 1; 21 switch ( i ) default : f( 3 ); 26 22 27 choose ( i ) case 3 : i = 1; 28 choose ( i ) default : i = 1; 29 choose ( i ) { 30 int i; 31 case 3: 32 case 'A' ... 'Z': 33 case 5 ... 6: 34 case 2, 4, 7: 35 i = 3; 36 fallthru; 37 default: 38 i = 3; 39 case 8~10: 40 fallthru 41 } 23 switch ( 3 ) 24 default: 25 case 2: 26 case 3: 27 f( 3 ); 28 29 switch ( i ) {} 30 switch ( i ) { 31 case 3: 32 f( 3 ); 33 } // switch 34 35 // switch (3 ) { 36 // int j; 37 // case 3: 38 // break; 39 // case 4: 40 // j = 0; 41 // } 42 43 switch ( i ) { 44 int j = 0; 45 int k = 0; 46 struct S { int i; }; 47 S s; 48 case 8~10: 49 default: 50 i = 3; 51 case 3: 52 case 'A' ... 'Z': 53 case 5 ... 6: 54 case 2, 4: 55 j = 3; 56 f( 3 ); 57 break; 58 } // switch 59 60 choose ( i ) case 3 : f( 3 ); 61 choose ( i ) default : i = 1; 62 63 choose ( 3 ) 64 case 2: 65 default: 66 case 3: 67 f( 3 ); 68 69 choose ( i ) {} 70 choose ( i ) { 71 case 3: 72 f( 3 ); 73 } // choose 74 75 choose ( i ) { 76 int j = 0; 77 int k = 0; 78 struct S { int i; }; 79 S s; 80 case 3: 81 case 'A' ... 'Z': 82 case 5 ... 6: 83 case 2, 4, 7: 84 i = 3; 85 f( 3 ); 86 default: 87 j = 3; 88 case 8~10: 89 f( 3 ); 90 fallthru 91 case 'd': 92 j = 5; 93 } // choose 42 94 } 95 96 // Local Variables: // 97 // tab-width: 4 // 98 // compile-command: "cfa switch.c" // 99 // End: //
Note: See TracChangeset
for help on using the changeset viewer.