Changeset d298e03 for src


Ignore:
Timestamp:
May 19, 2017, 2:51:10 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
11ab8ea8
Parents:
0661678 (diff), 535adab (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' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r0661678 rd298e03  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 30 15:42:32 2017
    13 // Update Count     : 2318
     12// Last Modified On : Thu May 18 18:06:17 2017
     13// Update Count     : 2338
    1414//
    1515
     
    8585        } // for
    8686} // distExt
     87
     88bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    8789%}
    8890
     
    15561558sue_type_specifier:                                                                             // struct, union, enum + type specifier
    15571559        elaborated_type
    1558         | type_qualifier_list elaborated_type
    1559                 { $$ = $2->addQualifiers( $1 ); }
     1560        | type_qualifier_list
     1561                { if ( $1->type != nullptr && $1->type->forall ) forall = true; } // remember generic type
     1562          elaborated_type
     1563                { $$ = $3->addQualifiers( $1 ); }
    15601564        | sue_type_specifier type_qualifier
    15611565                { $$ = $1->addQualifiers( $2 ); }
     
    16131617                { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    16141618        | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
    1615                 { typedefTable.makeTypedef( *$3 ); }
     1619                {
     1620                        typedefTable.makeTypedef( *$3 );                        // create typedef
     1621                        if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1622                        forall = false;                                                         // reset
     1623                }
    16161624          '{' field_declaration_list '}'
    16171625                { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
  • src/tests/tuplePolymorphism.c

    r0661678 rd298e03  
    99// Author           : Rob Schluntz
    1010// Created On       : Tue Nov 16 10:38:00 2016
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Nov 16 10:39:18 2016
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu May 18 18:05:12 2017
     13// Update Count     : 4
    1414//
    1515
    1616// packed is needed so that structs are not passed with the same alignment as function arguments
    1717__attribute__((packed)) struct A {
    18   double x;
    19   char y;
    20   double z;
     18        double x;
     19        char y;
     20        double z;
    2121};
    2222
    2323__attribute__((packed)) struct B {
    24   long long x;
    25   char y;
    26   long long z;
     24        long long x;
     25        char y;
     26        long long z;
    2727};
    2828
     
    3939
    4040int main() {
    41   int x1 = 123, x3 = 456;
    42   double x2 = 999.123;
     41        int x1 = 123, x3 = 456;
     42        double x2 = 999.123;
    4343
    44   int i1 = 111, i3 = 222;
    45   double i2 = 333;
     44        int i1 = 111, i3 = 222;
     45        double i2 = 333;
    4646
    47   int d1 = 555, d3 = 444;
    48   double d2 = 666;
     47        int d1 = 555, d3 = 444;
     48        double d2 = 666;
    4949
    5050
    51   [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
    52   [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
    53   printf("%d %g %d\n", i1, i2, i3);
    54   printf("%d %g %d\n", d1, d2, d3);
     51        [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
     52        [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
     53        printf("%d %g %d\n", i1, i2, i3);
     54        printf("%d %g %d\n", d1, d2, d3);
    5555
    56   [double, double, double] zzz;
    57   zzz = [x1, x2, x3];
    58   printf("%g %g %g\n", zzz);
    59   [x1, x2, x3] = zzz+zzz;
    60   printf("%d %g %d\n", x1, x2, x3);
     56        [double, double, double] zzz;
     57        zzz = [x1, x2, x3];
     58        printf("%g %g %g\n", zzz);
     59        [x1, x2, x3] = zzz+zzz;
     60        printf("%d %g %d\n", x1, x2, x3);
    6161
    62   // ensure non-matching assertions are specialized correctly
    63   g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
     62        // ensure non-matching assertions are specialized correctly
     63        g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
    6464}
    6565
     
    7373// tab-width: 4 //
    7474// End: //
    75 
Note: See TracChangeset for help on using the changeset viewer.