Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r68f9c43 rf14d956  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 22 15:37:17 2018
    13 // Update Count     : 1033
     12// Last Modified On : Fri Apr 20 22:37:20 2018
     13// Update Count     : 1063
    1414//
    1515
     
    4747const char * DeclarationNode::aggregateNames[] = { "struct", "union", "trait", "coroutine", "monitor", "thread", "NoAggregateNames" };
    4848const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    49 const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "NoBuiltinTypeNames" };
     49const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5050
    5151UniqueName DeclarationNode::anonymous( "__anonymous" );
     
    7171        attr.expr = nullptr;
    7272        attr.type = nullptr;
     73
     74        assert.condition = nullptr;
     75        assert.message = nullptr;
    7376}
    7477
     
    8891        // asmName, no delete, passed to next stage
    8992        delete initializer;
     93
     94        delete assert.condition;
     95        delete assert.message;
    9096}
    9197
     
    117123        newnode->attr.expr = maybeClone( attr.expr );
    118124        newnode->attr.type = maybeClone( attr.type );
     125
     126        newnode->assert.condition = maybeClone( assert.condition );
     127        newnode->assert.message = maybeClone( assert.message );
    119128        return newnode;
    120129} // DeclarationNode::clone
     
    434443        return newnode;
    435444}
     445
     446DeclarationNode * DeclarationNode::newStaticAssert( ExpressionNode * condition, Expression * message ) {
     447        DeclarationNode * newnode = new DeclarationNode;
     448        newnode->assert.condition = condition;
     449        newnode->assert.message = message;
     450        return newnode;
     451}
     452
    436453
    437454void appendError( string & dst, const string & src ) {
     
    544561
    545562        checkQualifiers( type, q->type );
     563        if ( (builtin == Zero || builtin == One) && error.length() == 0 ) {
     564                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, Type::QualifiersNames[ilog2( q->type->qualifiers.val )], builtinTypeNames[builtin] );
     565//              appendError( error, string( "questionable qualifiers" ) );
     566        } // if
    546567        addQualifiersToType( q->type, type );
    547568
     
    907928                                delete newType->aggInst.aggregate->enumeration.constants;
    908929                                newType->aggInst.aggregate->enumeration.constants = nullptr;
     930                                newType->aggInst.aggregate->enumeration.body = false;
    909931                        } else {
    910932                                assert( newType->aggInst.aggregate->kind == TypeData::Aggregate );
    911933                                delete newType->aggInst.aggregate->aggregate.fields;
    912934                                newType->aggInst.aggregate->aggregate.fields = nullptr;
     935                                newType->aggInst.aggregate->aggregate.body = false;
    913936                        } // if
    914937                        // don't hoist twice
     
    9861009                                        obj->location = cur->location;
    9871010                                        * out++ = obj;
     1011                                        delete agg;
    9881012                                } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
    9891013                                        UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
     
    10501074                return buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
    10511075        } // if
     1076
     1077        if ( assert.condition ) {
     1078                return new StaticAssertDecl( maybeBuild< Expression >( assert.condition ), strict_dynamic_cast< ConstantExpr * >( maybeClone( assert.message ) ) );
     1079        }
    10521080
    10531081        // SUE's cannot have function specifiers, either
Note: See TracChangeset for help on using the changeset viewer.