source: tests/switch.cfa @ 048dde4

Last change on this file since 048dde4 was 641707d, checked in by Andrew Beach <ajbeach@…>, 3 months ago

More fixing of warnings. Including another error that slipped through to the build and the rest of the 'easy' fixes on tests not in a directory.

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[4e06c1e]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//
[641707d]7// switch.cfa --
[4e06c1e]8//
9// Author           : Peter A. Buhr
10// Created On       : Tue Jul 12 06:50:22 2016
11// Last Modified By : Peter A. Buhr
[d96f7c4]12// Last Modified On : Fri Jan 17 14:10:12 2025
13// Update Count     : 45
[641707d]14//
[4e06c1e]15
16int f( int i ) { return i; }
17
[a16d833]18int main( void ) {
[4e06c1e]19        int i = 0;
20        switch ( i ) case 3 : i = 1;
21        switch ( i ) default : f( 3 );
22
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
[057b34f]35        switch ( 3 ) {
36                int j;
37          case 3:
38                break;
39          case 4:
40                j = 0;
41        }
[4e06c1e]42
[8688ce1]43        switch ( i ) {
44          case 1, 2, 3:
45                switch ( i ) {
46                  case 2, 3, 4:
47                        7;
48                }
49        }
50
[4e06c1e]51        switch ( i ) {
52                int j = 0;
53                int k = 0;
54                struct S { int i; };
55                S s;
56          case 8~10:
57          default:
58                i = 3;
[641707d]59                s = (S){ -7 };
60                fallthrough;
[ac911f4]61          case 19:
[4e06c1e]62          case 'A' ... 'Z':
[ac911f4]63          case 1 ... 6:
64          case 20, 30:
[4e06c1e]65                j = 3;
66                f( 3 );
[641707d]67                k = 5;
[4e06c1e]68                break;
69        } // switch
70
71        choose ( i ) case 3 : f( 3 );
72        choose ( i ) default : i = 1;
73
74        choose ( 3 )
75          case 2:
76          default:
77          case 3:
78                f( 3 );
79
80        choose ( i ) {}
81        choose ( i ) {
82          case 3:
83                f( 3 );
84        } // choose
85
86        choose ( i ) {
87                int j = 0;
88                int k = 0;
89                struct S { int i; };
90                S s;
[ac911f4]91          case 19:
[deb52a0]92          case 'A'...'Z':
93          case 0 ...6:                                                                          // space required, or lexed as decimal point
[ac911f4]94          case 20, 30, 40:
[4e06c1e]95                i = 3;
96                f( 3 );
[641707d]97                s = (S){ -7 };
[4e06c1e]98          default:
99                j = 3;
100          case 8~10:
101                f( 3 );
[d96f7c4]102                fallthrough;
[4e06c1e]103          case 'd':
[641707d]104                k = 5;
[4e06c1e]105        } // choose
[66812dd]106
[2853d6f]107        printf("done\n");
[a16d833]108} // main
[4e06c1e]109
110// Local Variables: //
111// tab-width: 4 //
[dc8511c]112// compile-command: "cfa switch.cfa" //
[4e06c1e]113// End: //
Note: See TracBrowser for help on using the repository browser.