Ignore:
Timestamp:
Dec 12, 2018, 3:52:19 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
1b8f13f0
Parents:
cdc02f2 (diff), 85acec94 (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' into shared_library

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/fallthrough.cfa

    rcdc02f2 r515a037  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // fallthrough.c --
     7// fallthrough.cfa --
    88//
    99// Author           : Rob Schluntz
    1010// Created On       : Wed Mar 14 10:06:25 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 16 08:21:46 2018
    13 // Update Count     : 14
     12// Last Modified On : Tue Dec  4 21:36:14 2018
     13// Update Count     : 17
    1414//
     15
     16#include <fstream.hfa>
    1517
    1618void test(int choice) {
    1719        choose ( choice ) {
    1820                case 1:
    19                         printf("case 1\n");
     21                        sout | "case 1";
    2022                        fallthru;
    2123                case 2:
    22                         printf("case 2\n");
     24                        sout | "case 2";
    2325                        fallthru;
    24                         printf("did not fallthru\n");
     26                        sout | "did not fallthru";
    2527                        if ( 7 ) fallthru common2;
    2628                        fallthru common1;
    2729                case 3:
    28                         printf("case 3\n");
     30                        sout | "case 3";
    2931                        fallthru default;
    3032                        fallthru common1;
    3133                common1:
    32                         printf("common1\n");
     34                        sout | "common1";
    3335                // break
    3436                case 4:
    35                         printf("case 4\n");
     37                        sout | "case 4";
    3638                        fallthru common2;
    3739                case 5:
    38                         printf("case 5\n");
     40                        sout | "case 5";
    3941                        fallthru common2;
    4042                        fallthru default;
    4143                case 6:
    42                         printf("case 6\n");
     44                        sout | "case 6";
    4345                        fallthru common2;
    4446                common2:
    45                         printf("common2\n");
     47                        sout | "common2";
    4648                // break
    4749                default:
    48                         printf("default\n");
     50                        sout | "default";
    4951                        fallthru;
    5052        }
    5153
    52         printf("\n");
     54        sout | nl;
    5355
    5456        switch ( choice ) {
    5557          case 1:
    56                 printf("case 1\n");
     58                sout | "case 1";
    5759                switch ( choice ) {
    5860                  case 1:
    59                         printf("case 1\n");
     61                        sout | "case 1";
    6062                        for ( int i = 0; i < 4; i += 1 ) {
    6163                                printf("%d\n", i);
     
    6567                break;
    6668          case 5:
    67                 printf("case 5\n");
     69                sout | "case 5";
    6870                if ( choice == 5 ) {
    6971                        if ( choice != 5 ) {
    70                                 printf("error\n");
     72                                sout | "error";
    7173                        } else {
    72                                 printf("check\n");
     74                                sout | "check";
    7375                                fallthru common;
    7476                        } // if
     
    114116
    115117int main() {
    116         test(1);
    117         printf("\n");
    118         test(5);
     118        test( 1 );
     119        sout | nl;
     120        test( 5 );
    119121}
    120122
    121123// Local Variables: //
    122124// tab-width: 4 //
    123 // compile-command: "cfa fallthrough.c" //
     125// compile-command: "cfa fallthrough.cfa" //
    124126// End: //
Note: See TracChangeset for help on using the changeset viewer.