Ignore:
Timestamp:
Jul 25, 2022, 2:23:28 PM (3 years ago)
Author:
Fangren Yu <f37yu@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
4c48be0, 5cf1228, def751f
Parents:
9e23b446 (diff), 1f950c3b (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:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9e23b446 rffec1bf  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 14 09:16:22 2022
    13 // Update Count     : 5401
     12// Last Modified On : Fri Jul  1 15:35:08 2022
     13// Update Count     : 5405
    1414//
    1515
     
    5656
    5757#include "SynTree/Attribute.h"     // for Attribute
     58
     59// lex uses __null in a boolean context, it's fine.
     60#pragma GCC diagnostic ignored "-Wparentheses-equality"
    5861
    5962extern DeclarationNode * parseTree;
     
    12401243                {
    12411244                        $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) );
    1242                         SemanticWarning( yylloc, Warning::SuperfluousElse );
     1245                        SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
    12431246                }
    12441247        | WHILE '(' conditional_declaration ')' statement       %prec THEN
     
    12511254                {
    12521255                        $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) );
    1253                         SemanticWarning( yylloc, Warning::SuperfluousElse );
     1256                        SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
    12541257                }
    12551258        | DO statement WHILE '(' comma_expression ')' ';'
     
    12621265                {
    12631266                        $$ = new StatementNode( build_for( new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ), maybe_build_compound( $4 ) ) );
    1264                         SemanticWarning( yylloc, Warning::SuperfluousElse );
     1267                        SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
    12651268                }
    12661269        | FOR '(' for_control_expression_list ')' statement     %prec THEN
     
    23942397        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    23952398                {
    2396                         if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 
     2399                        if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 )
    23972400                        { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); }
    23982401
     
    24382441        // empty
    24392442                { $$ = nullptr; }
    2440         // | '=' constant_expression
    2441         //      { $$ = $2; }
    2442         | simple_assignment_operator initializer
    2443                 { $$ = $1 == OperKinds::Assign ? $2 : $2->set_maybeConstructed( false ); }
     2443        | '=' constant_expression                                       { $$ = new InitializerNode( $2 ); }
     2444        | '=' '{' initializer_list_opt comma_opt '}' { $$ = new InitializerNode( $3, true ); }
     2445        // | simple_assignment_operator initializer
     2446        //      { $$ = $1 == OperKinds::Assign ? $2 : $2->set_maybeConstructed( false ); }
    24442447        ;
    24452448
     
    28412844                        linkage = LinkageSpec::update( yylloc, linkage, $2 );
    28422845                }
    2843           up external_definition down 
     2846          up external_definition down
    28442847                {
    28452848                        linkage = linkageStack.top();
Note: See TracChangeset for help on using the changeset viewer.