Changeset b38f6da


Ignore:
Timestamp:
Jun 17, 2023, 6:48:23 PM (17 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
a983cbf
Parents:
600478d
Message:

update conflicting type-specifier error-messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r600478d rb38f6da  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Apr 20 11:46:00 2023
    13 // Update Count     : 1393
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jun 17 14:41:48 2023
     13// Update Count     : 1405
    1414//
    1515
     
    459459        std::vector<ast::ptr<ast::Expr>> exprs;
    460460        buildList( expr, exprs );
    461         newnode->attributes.push_back(
    462                 new ast::Attribute( *name, std::move( exprs ) ) );
     461        newnode->attributes.push_back( new ast::Attribute( *name, std::move( exprs ) ) );
    463462        delete name;
    464463        return newnode;
     
    633632                                        dst->basictype = src->basictype;
    634633                                } else if ( src->basictype != DeclarationNode::NoBasicType )
    635                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: " );
     634                                        SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::basicTypeNames[ dst->basictype ] +
     635                                                                   "\" and \"" + DeclarationNode::basicTypeNames[ src->basictype ] + "\"." );
    636636
    637637                                if ( dst->complextype == DeclarationNode::NoComplexType ) {
    638638                                        dst->complextype = src->complextype;
    639639                                } else if ( src->complextype != DeclarationNode::NoComplexType )
    640                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: " );
     640                                        SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::complexTypeNames[ src->complextype ] +
     641                                                                   "\" and \"" + DeclarationNode::complexTypeNames[ src->complextype ] + "\"." );
    641642
    642643                                if ( dst->signedness == DeclarationNode::NoSignedness ) {
    643644                                        dst->signedness = src->signedness;
    644645                                } else if ( src->signedness != DeclarationNode::NoSignedness )
    645                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: " );
     646                                        SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::signednessNames[ dst->signedness ] +
     647                                                                   "\" and \"" + DeclarationNode::signednessNames[ src->signedness ] + "\"." );
    646648
    647649                                if ( dst->length == DeclarationNode::NoLength ) {
     
    650652                                        dst->length = DeclarationNode::LongLong;
    651653                                } else if ( src->length != DeclarationNode::NoLength )
    652                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: " );
     654                                        SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::lengthNames[ dst->length ] +
     655                                                                   "\" and \"" + DeclarationNode::lengthNames[ src->length ] + "\"." );
    653656                        } // if
    654657                        break;
     
    718721
    719722DeclarationNode * DeclarationNode::addEnumBase( DeclarationNode * o ) {
    720         if ( o && o -> type)  {
     723        if ( o && o->type)  {
    721724                type->base= o->type;
    722         }
     725        } // if
    723726        delete o;
    724727        return this;
     
    10031006}
    10041007
    1005 // If a typedef wraps an anonymous declaration, name the inner declaration
    1006 // so it has a consistent name across translation units.
     1008// If a typedef wraps an anonymous declaration, name the inner declaration so it has a consistent name across
     1009// translation units.
    10071010static void nameTypedefedDecl(
    10081011                DeclarationNode * innerDecl,
     
    10851088}
    10861089
    1087 void buildList( DeclarationNode * firstNode,
    1088                 std::vector<ast::ptr<ast::Decl>> & outputList ) {
     1090void buildList( DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList ) {
    10891091        SemanticErrorException errors;
    10901092        std::back_insert_iterator<std::vector<ast::ptr<ast::Decl>>> out( outputList );
Note: See TracChangeset for help on using the changeset viewer.