Changeset cde3891 for tests/raii


Ignore:
Timestamp:
Jan 23, 2019, 4:52:16 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a200795
Parents:
9b086ca (diff), 1d832f4 (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 cleanup-dtors

Location:
tests/raii
Files:
4 edited
6 moved

Legend:

Unmodified
Added
Removed
  • tests/raii/.expect/ctor-autogen-ERR1.txt

    r9b086ca rcde3891  
    1 raii/ctor-autogen.c:102:1 error: Unique best alternative includes deleted identifier in Cast of:
     1raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Cast of:
    22  Application of
    33    Deleted Expression
    44      Variable Expression: ?{}: static inline function
    55      ... with parameters
    6         _dst: reference to instance of struct Managed with body 1 
     6        _dst: reference to instance of struct Managed with body 1
    77        x: signed int
    8       ... returning nothing 
     8      ... returning nothing
    99
    1010      ... deleted by: ?{}: function
    1111      ... with parameters
    12         m: reference to instance of struct Managed with body 1 
    13       ... returning nothing 
    14       ... with body 
     12        m: reference to instance of struct Managed with body 1
     13      ... returning nothing
     14      ... with body
    1515        CompoundStmt
    1616          Expression Statement:
     
    2020                intrinsic reference to signed int
    2121                intrinsic signed int
    22               ... returning 
     22              ... returning
    2323                _retval__operator_assign: signed int
    24                 ... with attributes: 
     24                ... with attributes:
    2525                  Attribute with name: unused
    2626
     
    2828            ... to arguments
    2929              Cast of:
    30                 Member Expression, with field: 
     30                Member Expression, with field:
    3131                  x: signed int
    32                 ... from aggregate: 
     32                ... from aggregate:
    3333                  Cast of:
    34                     Variable Expression: m: reference to instance of struct Managed with body 1 
     34                    Variable Expression: m: reference to instance of struct Managed with body 1
    3535                  ... to:
    36                     instance of struct Managed with body 1 
     36                    instance of struct Managed with body 1
    3737              ... to:
    3838                reference to signed int
     
    4949  ... to arguments
    5050    Cast of:
    51       Variable Expression: x: instance of struct Managed with body 1 
     51      Variable Expression: x: instance of struct Managed with body 1
    5252    ... to:
    53       reference to instance of struct Managed with body 1 
     53      reference to instance of struct Managed with body 1
    5454    constant expression (123 123: signed int)
    5555
  • tests/raii/.expect/dtor-early-exit-ERR1.txt

    r9b086ca rcde3891  
    1 raii/dtor-early-exit.c:150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)
     1raii/dtor-early-exit.cfa:150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)
    22  with target: L1
    33  with original target: L1
  • tests/raii/.expect/dtor-early-exit-ERR2.txt

    r9b086ca rcde3891  
    1 raii/dtor-early-exit.c:214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)
     1raii/dtor-early-exit.cfa:214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)
    22  with target: L2
    33  with original target: L2
  • tests/raii/.expect/memberCtors-ERR1.txt

    r9b086ca rcde3891  
    1 raii/memberCtors.c:92:1 error: in void ?{}(B &b), field a2 used before being constructed
     1raii/memberCtors.cfa:92:1 error: in void ?{}(B &b), field a2 used before being constructed
  • tests/raii/dtor-early-exit.cfa

    r9b086ca rcde3891  
    1010// Created On       : Wed Aug 17 08:26:25 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 11 07:58:39 2018
    13 // Update Count     : 8
     12// Last Modified On : Fri Dec 21 08:45:19 2018
     13// Update Count     : 10
    1414//
    1515
     
    2525// don't want these called
    2626void ?{}(A & a) { assert( false ); }
    27 void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name | endl; a.x = (int*)malloc(); }
     27void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); }
    2828void ?{}(A & a, const char * name, int * ptr) { assert( false ); }
    2929
    3030A ?=?(A & a, A b) {  sout | "assign " | a.name | " " | b.name; return a; }
    31 void ?{}(A & a, A b) { sout | "copy construct " | b.name | endl; a.x = (int*)malloc(); }
    32 void ^?{}(A & a) { sout | "destruct " | a.name | endl; free(a.x); }
     31void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); }
     32void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); }
    3333
    3434// test returns
    3535void f(int i) {
    36         sout | "f i=" | i | endl;
     36        sout | "f i=" | i;
    3737        A x = { "x" };  // construct x
    3838        {
     
    5555void g() {
    5656        for (int i = 0; i < 10; i++) {
    57                 sout | "g for i=" | i | endl;
     57                sout | "g for i=" | i;
    5858                A x = { "x" };
    5959                // construct x
    6060                // destruct x
    6161        }
    62         sout | endl;
     62        sout | nl;
    6363        {
    6464                int i = 0;
    6565                while (i < 10) {
    66                         sout | "g while i=" | i | endl;
     66                        sout | "g while i=" | i;
    6767                        A x = { "x" };
    6868                        // construct x
     
    7171                }
    7272        }
    73         sout | endl;
     73        sout | nl;
    7474        for (int i = 0; i < 10; i++) {
    7575                switch(10) {
     
    7878                        case 10: {
    7979                                A y = { "y" };
    80                                 sout | "g switch i=" | i | endl;
     80                                sout | "g switch i=" | i;
    8181                                // construct y
    8282                                break; // destruct y
    8383                        }
    8484                        default: {
    85                                 sout | "g switch i=" | i | endl;
     85                                sout | "g switch i=" | i;
    8686                                A x = { "x" };
    8787                                // construct x
     
    9090                }
    9191        }
    92         sout | endl;
     92        sout | nl;
    9393        for (int k = 0; k < 2; k++) {
    94                 sout | "g for k=" | k | endl;
     94                sout | "g for k=" | k;
    9595                L1: for (int i = 0; i < 10; i++) {
    96                         sout | "g for i=" | i | endl;
     96                        sout | "g for i=" | i;
    9797
    9898                        A x = { "x" };
    9999                        if (i == 2) {
    100                                 sout | "continue L1" | endl;
     100                                sout | "continue L1";
    101101                                continue;  // destruct x
    102102                        } else if (i == 3) {
    103                                 sout | "break L1" | endl;
     103                                sout | "break L1";
    104104                                break;  // destruct x
    105105                        }
    106106
    107107                        L2: for (int j = 0; j < 10; j++) {
    108                                 sout | "g for j=" | j | endl;
     108                                sout | "g for j=" | j;
    109109                                A y = { "y" };
    110110                                if (j == 0) {
    111                                         sout | "continue L2" | endl;
     111                                        sout | "continue L2";
    112112                                        continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block
    113113                                } else if (j == 1) {
    114                                         sout | "break L2" | endl;
     114                                        sout | "break L2";
    115115                                        break;  // destruct y
    116116                                } else if (i == 1) {
    117                                         sout | "continue L1" | endl;
     117                                        sout | "continue L1";
    118118                                        continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y
    119119                                } else if (k == 1) {
    120                                         sout | "break L1" | endl;
     120                                        sout | "break L1";
    121121                                        break L1;  // destruct x,y
    122122                                }
     
    125125        }
    126126
    127         sout | endl;
     127        sout | nl;
    128128        L3: if( 3 ) {
    129129                A w = { "w" };
    130130                if( 4 ) {
    131131                        A v = { "v" };
    132                         sout | "break L3" | endl;
     132                        sout | "break L3";
    133133                        break L3;
    134134                }
     
    144144        // * if S_L-S_G is non-empty, error
    145145        // * emit destructors for all variables in S_G-S_L
    146         sout | "h" | endl;
     146        sout | "h";
    147147        {
    148148                L0: ;
     
    152152                        A y = { "y" };
    153153                        // S_L1 = { y }
    154                 L1: sout | "L1" | endl;
     154                L1: sout | "L1";
    155155                        A x = { "x" };
    156156                        // S_L2 = { y, x }
    157                 L2: sout | "L2" | endl;
     157                L2: sout | "L2";
    158158                        if (i == 0) {
    159159                                ++i;
    160                                 sout | "goto L1" | endl;
     160                                sout | "goto L1";
    161161                                // S_G = { y, x }
    162162                                goto L1;  // jump back, destruct b/c before x definition
     
    165165                        } else if (i == 1) {
    166166                                ++i;
    167                                 sout | "goto L2" | endl;
     167                                sout | "goto L2";
    168168                                // S_G = { y, x }
    169169                                goto L2;  // jump back, do not destruct
     
    172172                        } else if (i == 2) {
    173173                                ++i;
    174                                 sout | "goto L3" | endl;
     174                                sout | "goto L3";
    175175                                // S_G = { y, x }
    176176                                goto L3;  // jump ahead, do not destruct
     
    180180                                ++i;
    181181                                A z = { "z" };
    182                                 sout | "goto L3-2" | endl;
     182                                sout | "goto L3-2";
    183183                                // S_G = { z, y, x }
    184184                                goto L3;
     
    187187                        } else {
    188188                                ++i;
    189                                 sout | "goto L4" | endl;
     189                                sout | "goto L4";
    190190                                // S_G = { y, x }
    191191                                goto L4;  // jump ahead, destruct b/c left block x was defined in
     
    194194                        }
    195195                        // S_L3 = { y, x }
    196                 L3: sout | "L3" | endl;
    197                         sout | "goto L2-2" | endl;
     196                L3: sout | "L3";
     197                        sout | "goto L2-2";
    198198                        // S_G = { y, x }
    199199                        goto L2; // jump back, do not destruct
     
    202202        }
    203203        // S_L4 = {}
    204         L4: sout | "L4" | endl;
     204        L4: sout | "L4";
    205205        if (i == 4) {
    206                 sout | "goto L0" | endl;
     206                sout | "goto L0";
    207207                // S_G = {}
    208208                goto L0;
     
    240240                f(i);
    241241        }
    242         sout | endl;
     242        sout | nl;
    243243        g();
    244         sout | endl;
     244        sout | nl;
    245245        h();
    246246
  • tests/raii/globals.cfa

    r9b086ca rcde3891  
    7070
    7171int main() {
    72         sout | "static\t\tinline\t\tautogen\t\tvalue" | endl;
     72        sout | "static\t\tinline\t\tautogen\t\tvalue";
    7373
    74         sout | "no \t\tno \t\tno \t\t" | g.val.value    | endl;
    75         sout | "no \t\tno \t\tyes\t\t" | ga.val.value   | endl;
    76         sout | "no \t\tyes\t\tno \t\t" | gi.val.value   | endl;
    77         sout | "no \t\tyes\t\tyes\t\t" | gia.val.value  | endl;
    78         sout | "yes\t\tno \t\tno \t\t" | gs.val.value   | endl;
    79         sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value  | endl;
    80         sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value  | endl;
    81         sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value | endl;
     74        sout | "no \t\tno \t\tno \t\t" | g.val.value;
     75        sout | "no \t\tno \t\tyes\t\t" | ga.val.value;
     76        sout | "no \t\tyes\t\tno \t\t" | gi.val.value;
     77        sout | "no \t\tyes\t\tyes\t\t" | gia.val.value;
     78        sout | "yes\t\tno \t\tno \t\t" | gs.val.value;
     79        sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value;
     80        sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value;
     81        sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value;
    8282
    8383}
Note: See TracChangeset for help on using the changeset viewer.