Changes in / [fc4a0fa:1eba452]


Ignore:
Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rfc4a0fa r1eba452  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 14 23:13:28 2016
    13 // Update Count     : 502
     12// Last Modified On : Sun Sep 11 09:24:11 2016
     13// Update Count     : 438
    1414//
    1515
     
    3232// These must remain in the same order as the corresponding DeclarationNode enumerations.
    3333const char *DeclarationNode::storageName[] = { "extern", "static", "auto", "register", "inline", "fortran", "_Noreturn", "_Thread_local", "NoStorageClass" };
    34 const char *DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue", "_Atomic", "NoQualifier" };
    35 const char *DeclarationNode::basicTypeName[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicType" };
    36 const char *DeclarationNode::complexTypeName[] = { "_Complex", "_Imaginary", "NoComplexType" };
    37 const char *DeclarationNode::signednessName[] = { "signed", "unsigned", "NoSignedness" };
    38 const char *DeclarationNode::lengthName[] = { "short", "long", "long long", "NoLength" };
     34const char *DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue", "_Atomic" };
     35const char *DeclarationNode::basicTypeName[] = { "char", "int", "float", "double", "void", "_Bool", "_Complex", "_Imaginary",  };
     36const char *DeclarationNode::modifierName[]  = { "signed", "unsigned", "short", "long" };
    3937const char *DeclarationNode::aggregateName[] = { "struct", "union", "context" };
    40 const char *DeclarationNode::typeClassName[] = { "otype", "dtype", "ftype" };
     38const char *DeclarationNode::typeClassName[] = { "type", "dtype", "ftype" };
    4139const char *DeclarationNode::builtinTypeName[] = { "__builtin_va_list" };
    4240
     
    5553                linkage( ::linkage ),
    5654                extension( false ) {
    57         variable.tyClass = DeclarationNode::Otype;
     55        variable.tyClass = DeclarationNode::Type;
    5856        variable.assertions = nullptr;
    5957
     
    190188        DeclarationNode *newnode = new DeclarationNode;
    191189        newnode->type = new TypeData( TypeData::Basic );
    192         newnode->type->basictype = bt;
     190        newnode->type->basic.typeSpec.push_back( bt );
    193191        return newnode;
    194192} // DeclarationNode::newBasicType
    195193
    196 DeclarationNode * DeclarationNode::newComplexType( ComplexType ct ) {
     194DeclarationNode * DeclarationNode::newModifier( Modifier mod ) {
    197195        DeclarationNode *newnode = new DeclarationNode;
    198196        newnode->type = new TypeData( TypeData::Basic );
    199         newnode->type->complextype = ct;
    200         return newnode;
    201 } // DeclarationNode::newComplexType
    202 
    203 DeclarationNode * DeclarationNode::newSignedNess( Signedness sn ) {
    204         DeclarationNode *newnode = new DeclarationNode;
    205         newnode->type = new TypeData( TypeData::Basic );
    206         newnode->type->signedness = sn;
    207         return newnode;
    208 } // DeclarationNode::newSignedNess
    209 
    210 DeclarationNode * DeclarationNode::newLength( Length lnth ) {
    211         DeclarationNode *newnode = new DeclarationNode;
    212         newnode->type = new TypeData( TypeData::Basic );
    213         newnode->type->length = lnth;
    214         return newnode;
    215 } // DeclarationNode::newLength
     197        newnode->type->basic.modifiers.push_back( mod );
     198        return newnode;
     199} // DeclarationNode::newModifier
    216200
    217201DeclarationNode * DeclarationNode::newFromTypedef( std::string *name ) {
     
    383367}
    384368
    385 void appendError( string & dst, const string & src ) {
    386         if ( src.empty() ) return;
    387         if ( dst.empty() ) { dst = src; return; }
    388         dst += ", " + src;
    389 } // appendError
     369static void addQualifiersToType( TypeData *&src, TypeData *dst ) {
     370        if ( src && dst ) {
     371                if ( src->forall && dst->kind == TypeData::Function ) {
     372                        if ( dst->forall ) {
     373                                dst->forall->appendList( src->forall );
     374                        } else {
     375                                dst->forall = src->forall;
     376                        } // if
     377                        src->forall = 0;
     378                } // if
     379                if ( dst->base ) {
     380                        addQualifiersToType( src, dst->base );
     381                } else if ( dst->kind == TypeData::Function ) {
     382                        dst->base = src;
     383                        src = 0;
     384                } else {
     385                        dst->qualifiers |= src->qualifiers;
     386                } // if
     387        } // if
     388}
    390389
    391390void DeclarationNode::checkQualifiers( const TypeData *src, const TypeData *dst ) {
     
    393392
    394393        if ( (qsrc & qdst).any() ) {                                            // common qualifier ?
    395                 for ( int i = 0; i < NoQualifier; i += 1 ) {    // find common qualifiers
    396                         if ( qsrc[i] && qdst[i] ) {
    397                                 appendError( error, string( "duplicate " ) + DeclarationNode::qualifierName[i] );
     394                for ( int i = 0; i < NoOfQualifier; i += 1 ) {  // find common qualifiers
     395                        if ( qsrc[i] & qdst[i] ) {
     396                                if ( ! error.empty() ) error += ", ";   // separator
     397                                error += string( "duplicate " ) + DeclarationNode::qualifierName[i];
    398398                        } // if
    399399                } // for
     
    403403void DeclarationNode::checkStorageClasses( DeclarationNode *q ) {
    404404        if ( storageClass != NoStorageClass && q->storageClass != NoStorageClass ) {
     405                if ( ! error.empty() ) error += ", ";                   // separator
    405406                if ( storageClass == q->storageClass ) {                // duplicate qualifier
    406                         appendError( error, string( "duplicate " ) + storageName[ storageClass ] );
     407                        error += string( "duplicate " ) + storageName[ storageClass ];
    407408                } else {                                                                                // only one storage class
    408                         appendError( error, string( "conflicting " ) + storageName[ storageClass ] + " & " + storageName[ q->storageClass ] );
    409                         q->storageClass = storageClass;                         // FIX ERROR, prevent assertions from triggering
    410                 } // if
    411         } // if
    412         appendError( error, q->error );
     409                        error += string( "conflicting " ) + storageName[ storageClass ] + " & " + storageName[ q->storageClass ];
     410                        q->storageClass = storageClass;                         // FIX ERROR
     411                } // if
     412                if ( ! q->error.empty() ) error += ", " + q->error;     // separator
     413        } else {
     414                if ( ! error.empty() ) {
     415                        if ( ! q->error.empty() ) error += ", " + q->error; // separator
     416                } else if ( ! q->error.empty() ) error += q->error;
     417        } // if
    413418} // DeclarationNode::copyStorageClasses
    414419
    415420DeclarationNode *DeclarationNode::copyStorageClasses( DeclarationNode *q ) {
    416         isInline = isInline || q->isInline;
    417         isNoreturn = isNoreturn || q->isNoreturn;
     421        isInline = isInline | q->isInline;
     422        isNoreturn = isNoreturn | q->isNoreturn;
    418423        // do not overwrite an existing value with NoStorageClass
    419424        if ( q->storageClass != NoStorageClass ) {
     
    424429} // DeclarationNode::copyStorageClasses
    425430
    426 static void addQualifiersToType( TypeData *&src, TypeData *dst ) {
    427         if ( src->forall && dst->kind == TypeData::Function ) {
    428                 if ( dst->forall ) {
    429                         dst->forall->appendList( src->forall );
     431DeclarationNode *DeclarationNode::addQualifiers( DeclarationNode *q ) {
     432        if ( q ) {
     433                checkStorageClasses( q );
     434                copyStorageClasses( q );
     435                if ( q->type ) {
     436                        if ( ! type ) {
     437                                type = new TypeData;
     438                        } else {
     439                                checkQualifiers( q->type, type );
     440                        } // if
     441                        addQualifiersToType( q->type, type );
     442                        if ( q->type && q->type->forall ) {
     443                                if ( type->forall ) {
     444                                        type->forall->appendList( q->type->forall );
     445                                } else {
     446                                        if ( type->kind == TypeData::Aggregate ) {
     447                                                type->aggregate.params = q->type->forall;
     448                                                // change implicit typedef from TYPEDEFname to TYPEGENname
     449                                                typedefTable.changeKind( type->aggregate.name, TypedefTable::TG );
     450                                        } else {
     451                                                type->forall = q->type->forall;
     452                                        } // if
     453                                } // if
     454                                q->type->forall = 0;
     455                        } // if
     456                } // if
     457        } // if
     458        delete q;
     459        return this;
     460}
     461
     462static void addTypeToType( TypeData *&src, TypeData *&dst ) {
     463        if ( src && dst ) {
     464                if ( src->forall && dst->kind == TypeData::Function ) {
     465                        if ( dst->forall ) {
     466                                dst->forall->appendList( src->forall );
     467                        } else {
     468                                dst->forall = src->forall;
     469                        } // if
     470                        src->forall = 0;
     471                } // if
     472                if ( dst->base ) {
     473                        addTypeToType( src, dst->base );
    430474                } else {
    431                         dst->forall = src->forall;
    432                 } // if
    433                 src->forall = 0;
    434         } // if
    435         if ( dst->base ) {
    436                 addQualifiersToType( src, dst->base );
    437         } else if ( dst->kind == TypeData::Function ) {
    438                 dst->base = src;
    439                 src = 0;
    440         } else {
    441                 dst->qualifiers |= src->qualifiers;
    442         } // if
    443 } // addQualifiersToType
    444 
    445 DeclarationNode *DeclarationNode::addQualifiers( DeclarationNode *q ) {
    446         if ( ! q ) return this;
    447 
    448         checkStorageClasses( q );
    449         copyStorageClasses( q );
    450 
    451         if ( ! q->type ) { delete q; return this; }
    452 
    453         if ( ! type ) {
    454 //              type = new TypeData;
    455                 type = q->type;
    456                 return this;
    457         } // if
    458 
    459         checkQualifiers( q->type, type );
    460         addQualifiersToType( q->type, type );
    461 
    462         if ( q->type->forall ) {
    463                 if ( type->forall ) {
    464                         type->forall->appendList( q->type->forall );
    465                 } else {
    466                         if ( type->kind == TypeData::Aggregate ) {
    467                                 type->aggregate.params = q->type->forall;
    468                                 // change implicit typedef from TYPEDEFname to TYPEGENname
    469                                 typedefTable.changeKind( type->aggregate.name, TypedefTable::TG );
    470                         } else {
    471                                 type->forall = q->type->forall;
    472                         } // if
    473                 } // if
    474                 q->type->forall = 0;
    475         } // if
    476         delete q;
    477         return this;
    478 } // addQualifiers
    479 
    480 static void addTypeToType( TypeData *&src, TypeData *&dst ) {
    481         if ( src->forall && dst->kind == TypeData::Function ) {
    482                 if ( dst->forall ) {
    483                         dst->forall->appendList( src->forall );
    484                 } else {
    485                         dst->forall = src->forall;
    486                 } // if
    487                 src->forall = 0;
    488         } // if
    489         if ( dst->base ) {
    490                 addTypeToType( src, dst->base );
    491         } else {
    492                 switch ( dst->kind ) {
    493                   case TypeData::Unknown:
    494                         src->qualifiers |= dst->qualifiers;
    495                         dst = src;
    496                         src = 0;
    497                         break;
    498                   case TypeData::Basic:
    499                         dst->qualifiers |= src->qualifiers;
    500                         if ( src->kind != TypeData::Unknown ) {
    501                                 assert( src->kind == TypeData::Basic );
    502 
    503                                 if ( dst->basictype == DeclarationNode::NoBasicType ) {
    504                                         dst->basictype = src->basictype;
    505                                 } else if ( src->basictype != DeclarationNode::NoBasicType )
    506                                         throw SemanticError( std::string( "conflicting type specifier " ) + DeclarationNode::basicTypeName[ src->basictype ] + " in type: ", src );
    507 
    508                                 if ( dst->complextype == DeclarationNode::NoComplexType ) {
    509                                         dst->complextype = src->complextype;
    510                                 } else if ( src->complextype != DeclarationNode::NoComplexType )
    511                                         throw SemanticError( std::string( "conflicting type specifier " ) + DeclarationNode::complexTypeName[ src->complextype ] + " in type: ", src );
    512 
    513                                 if ( dst->signedness == DeclarationNode::NoSignedness ) {
    514                                         dst->signedness = src->signedness;
    515                                 } else if ( src->signedness != DeclarationNode::NoSignedness )
    516                                         throw SemanticError( std::string( "conflicting type specifier " ) + DeclarationNode::signednessName[ src->signedness ] + " in type: ", src );
    517 
    518                                 if ( dst->length == DeclarationNode::NoLength ) {
    519                                         dst->length = src->length;
    520                                 } else if ( dst->length == DeclarationNode::Long && src->length == DeclarationNode::Long ) {
    521                                         dst->length = DeclarationNode::LongLong;
    522                                 } else if ( src->length != DeclarationNode::NoLength )
    523                                         throw SemanticError( std::string( "conflicting type specifier " ) + DeclarationNode::lengthName[ src->length ] + " in type: ", src );
    524                         } // if
    525                         break;
    526                   default:
    527                         switch ( src->kind ) {
    528                           case TypeData::Aggregate:
    529                           case TypeData::Enum:
    530                                 dst->base = new TypeData( TypeData::AggregateInst );
    531                                 dst->base->aggInst.aggregate = src;
    532                                 if ( src->kind == TypeData::Aggregate ) {
    533                                         dst->base->aggInst.params = maybeClone( src->aggregate.actuals );
    534                                 } // if
    535                                 dst->base->qualifiers |= src->qualifiers;
     475                        switch ( dst->kind ) {
     476                          case TypeData::Unknown:
     477                                src->qualifiers |= dst->qualifiers;
     478                                dst = src;
    536479                                src = 0;
    537480                                break;
     481                          case TypeData::Basic:
     482                                dst->qualifiers |= src->qualifiers;
     483                                if ( src->kind != TypeData::Unknown ) {
     484                                        assert( src->kind == TypeData::Basic );
     485                                        dst->basic.modifiers.splice( dst->basic.modifiers.end(), src->basic.modifiers );
     486                                        dst->basic.typeSpec.splice( dst->basic.typeSpec.end(), src->basic.typeSpec );
     487                                } // if
     488                                break;
    538489                          default:
    539                                 if ( dst->forall ) {
    540                                         dst->forall->appendList( src->forall );
    541                                 } else {
    542                                         dst->forall = src->forall;
    543                                 } // if
    544                                 src->forall = 0;
    545                                 dst->base = src;
    546                                 src = 0;
     490                                switch ( src->kind ) {
     491                                  case TypeData::Aggregate:
     492                                  case TypeData::Enum:
     493                                        dst->base = new TypeData( TypeData::AggregateInst );
     494                                        dst->base->aggInst.aggregate = src;
     495                                        if ( src->kind == TypeData::Aggregate ) {
     496                                                dst->base->aggInst.params = maybeClone( src->aggregate.actuals );
     497                                        } // if
     498                                        dst->base->qualifiers |= src->qualifiers;
     499                                        src = 0;
     500                                        break;
     501                                  default:
     502                                        if ( dst->forall ) {
     503                                                dst->forall->appendList( src->forall );
     504                                        } else {
     505                                                dst->forall = src->forall;
     506                                        } // if
     507                                        src->forall = 0;
     508                                        dst->base = src;
     509                                        src = 0;
     510                                } // switch
    547511                        } // switch
    548                 } // switch
     512                } // if
    549513        } // if
    550514}
     
    911875        while ( cur ) {
    912876                try {
     877///       if ( DeclarationNode *extr = cur->extractAggregate() ) {
     878///     // handle the case where a structure declaration is contained within an object or type
     879///     // declaration
     880///     Declaration *decl = extr->build();
     881///     if ( decl ) {
     882///          *out++ = decl;
     883///     }
     884///       }
    913885                        Declaration *decl = cur->build();
    914886                        if ( decl ) {
  • src/Parser/ParseNode.h

    rfc4a0fa r1eba452  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 08:00:05 2016
    13 // Update Count     : 603
     12// Last Modified On : Sat Sep 10 17:14:37 2016
     13// Update Count     : 589
    1414//
    1515
     
    196196class DeclarationNode : public ParseNode {
    197197  public:
    198         // These must remain in the same order as the corresponding DeclarationNode names.
     198        enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, NoOfQualifier };
    199199        enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, };
    200         enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, NoQualifier };
    201         enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType };
    202         enum ComplexType { Complex, Imaginary, NoComplexType };
    203         enum Signedness { Signed, Unsigned, NoSignedness };
    204         enum Length { Short, Long, LongLong, NoLength };
     200        enum BasicType { Char, Int, Float, Double, Void, Bool, Complex, Imaginary };
     201        enum Modifier  { Signed, Unsigned, Short, Long };
    205202        enum Aggregate { Struct, Union, Trait };
    206         enum TypeClass { Otype, Dtype, Ftype };
     203        enum TypeClass { Type, Dtype, Ftype };
    207204        enum BuiltinType { Valist };
    208205
     206        static const char * qualifierName[];
    209207        static const char * storageName[];
    210         static const char * qualifierName[];
    211208        static const char * basicTypeName[];
    212         static const char * complexTypeName[];
    213         static const char * signednessName[];
    214         static const char * lengthName[];
     209        static const char * modifierName[];
    215210        static const char * aggregateName[];
    216211        static const char * typeClassName[];
     
    222217        static DeclarationNode * newStorageClass( StorageClass );
    223218        static DeclarationNode * newBasicType( BasicType );
    224         static DeclarationNode * newComplexType( ComplexType );
    225         static DeclarationNode * newSignedNess( Signedness sn );
    226         static DeclarationNode * newLength( Length lnth );
     219        static DeclarationNode * newModifier( Modifier );
    227220        static DeclarationNode * newBuiltinType( BuiltinType );
    228221        static DeclarationNode * newFromTypedef( std::string *);
     
    316309        TypeData * type;
    317310        std::string name;
     311        // std::list< StorageClass > storageClasses;
    318312        StorageClass storageClass;
    319313        bool isInline, isNoreturn;
  • src/Parser/TypeData.cc

    rfc4a0fa r1eba452  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 21:11:22 2016
    13 // Update Count     : 377
     12// Last Modified On : Mon Aug 29 22:31:53 2016
     13// Update Count     : 277
    1414//
    1515
     
    178178                break;
    179179          case Basic:
    180                 newtype->basictype = basictype;
    181                 newtype->complextype = complextype;
    182                 newtype->signedness = signedness;
    183                 newtype->length = length;
     180                newtype->basic.typeSpec = basic.typeSpec;
     181                newtype->basic.modifiers = basic.modifiers;
    184182                break;
    185183          case Array:
     
    249247        using std::string;
    250248
    251         for ( int i = 0; i < DeclarationNode::NoQualifier; i += 1 ) {
     249        for ( int i = 0; i < DeclarationNode::NoOfQualifier; i += 1 ) {
    252250                if ( qualifiers[i] ) os << DeclarationNode::qualifierName[ i ] << ' ';
    253251        } // for
     
    273271                break;
    274272          case Basic:
    275                 if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessName[ signedness ] << " ";
    276                 if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthName[ length ] << " ";
    277                 assert( basictype != DeclarationNode::NoBasicType );
    278                 os << DeclarationNode::basicTypeName[ basictype ] << " ";
    279                 if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeName[ complextype ] << " ";
     273                printEnums( basic.modifiers.begin(), basic.modifiers.end(), DeclarationNode::modifierName, os );
     274                printEnums( basic.typeSpec.begin(), basic.typeSpec.end(), DeclarationNode::basicTypeName, os );
    280275                break;
    281276          case Array:
     
    423418                break;
    424419          default:
    425                 os << "internal error: TypeData::print " << kind << endl;
     420                os << "internal error: TypeData::print " << kind  << endl;
    426421                assert( false );
    427422        } // switch
     
    536531
    537532Type * buildBasicType( const TypeData * td ) {
     533        static const BasicType::Kind kindMap[] = { BasicType::Char, BasicType::SignedInt, BasicType::Float, BasicType::Double,
     534                                                                                           BasicType::Char /* void */, BasicType::Bool, BasicType::DoubleComplex,
     535                                                                                           BasicType::DoubleImaginary };
     536        bool init = false;
     537        bool sawDouble = false;
     538        bool sawSigned = false;
    538539        BasicType::Kind ret;
    539540
    540         switch ( td->basictype ) {
    541           case DeclarationNode::Void:
    542                 if ( td->signedness != DeclarationNode::NoSignedness && td->length != DeclarationNode::NoLength ) {
    543                         throw SemanticError( "invalid type specifier \"void\" in type: ", td );
    544                 } // if
    545 
    546                 return new VoidType( buildQualifiers( td ) );
    547                 break;
    548 
    549           case DeclarationNode::Bool:
    550                 if ( td->signedness != DeclarationNode::NoSignedness ) {
    551                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    552                 } // if
    553                 if ( td->length != DeclarationNode::NoLength ) {
    554                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    555                 } // if
    556 
    557                 ret = BasicType::Bool;
    558                 break;
    559 
    560           case DeclarationNode::Char:
    561                 // C11 Standard 6.2.5.15: The three types char, signed char, and unsigned char are collectively called the
    562                 // character types. The implementation shall define char to have the same range, representation, and behavior as
    563                 // either signed char or unsigned char.
    564                 static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char };
    565 
    566                 if ( td->length != DeclarationNode::NoLength ) {
    567                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    568                 } // if
    569 
    570                 ret = chartype[ td->signedness ];
    571                 break;
    572 
    573           case DeclarationNode::Int:
    574                 static BasicType::Kind inttype[2][4] = {
    575                         { BasicType::ShortSignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt },
    576                         { BasicType::ShortUnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt },
    577                 };
    578 
    579           Integral: ;
    580                 if ( td->signedness == DeclarationNode::NoSignedness ) {
    581                         const_cast<TypeData *>(td)->signedness = DeclarationNode::Signed;
    582                 } // if
    583                 ret = inttype[ td->signedness ][ td->length ];
    584                 break;
    585 
    586           case DeclarationNode::Float:
    587           case DeclarationNode::Double:
    588           case DeclarationNode::LongDouble:                                     // not set until below
    589                 static BasicType::Kind floattype[3][3] = {
    590                         { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
    591                         { BasicType::FloatImaginary, BasicType::DoubleImaginary, BasicType::LongDoubleImaginary },
    592                         { BasicType::Float, BasicType::Double, BasicType::LongDouble },
    593                 };
    594 
    595           FloatingPoint: ;
    596                 if ( td->signedness != DeclarationNode::NoSignedness ) {
    597                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    598                 } // if
    599                 if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    600                         throw SemanticError( std::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    601                 } // if
    602                 if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
    603                         throw SemanticError( "invalid type specifier \"long\" in type: ", td );
    604                 } // if
    605                 if ( td->length == DeclarationNode::Long ) {
    606                         const_cast<TypeData *>(td)->basictype = DeclarationNode::LongDouble;
    607                 } // if
    608 
    609                 ret = floattype[ td->complextype ][ td->basictype - DeclarationNode::Float ];
    610                 break;
    611 
    612           case DeclarationNode::NoBasicType:
    613                 // No basic type in declaration => default double for Complex/Imaginary and int type for integral types
    614                 if ( td->complextype == DeclarationNode::Complex || td->complextype == DeclarationNode::Imaginary ) {
    615                         const_cast<TypeData *>(td)->basictype = DeclarationNode::Double;
    616                         goto FloatingPoint;
    617                 } // if
    618 
    619                 const_cast<TypeData *>(td)->basictype = DeclarationNode::Int;
    620                 goto Integral;
    621         } // switch
    622 
    623         BasicType * bt = new BasicType( buildQualifiers( td ), ret );
     541        for ( std::list< DeclarationNode::BasicType >::const_iterator i = td->basic.typeSpec.begin(); i != td->basic.typeSpec.end(); ++i ) {
     542                if ( ! init ) {
     543                        init = true;
     544                        if ( *i == DeclarationNode::Void ) {
     545                                if ( td->basic.typeSpec.size() != 1 || ! td->basic.modifiers.empty() ) {
     546                                        throw SemanticError( "invalid type specifier \"void\" in type: ", td );
     547                                } else {
     548                                        return new VoidType( buildQualifiers( td ) );
     549                                } // if
     550                        } else {
     551                                ret = kindMap[ *i ];
     552                        } // if
     553                } else {
     554                        switch ( *i ) {
     555                          case DeclarationNode::Float:
     556                                if ( sawDouble ) {
     557                                        throw SemanticError( "invalid type specifier \"float\" in type: ", td );
     558                                } else {
     559                                        switch ( ret ) {
     560                                          case BasicType::DoubleComplex:
     561                                                ret = BasicType::FloatComplex;
     562                                                break;
     563                                          case BasicType::DoubleImaginary:
     564                                                ret = BasicType::FloatImaginary;
     565                                                break;
     566                                          default:
     567                                                throw SemanticError( "invalid type specifier \"float\" in type: ", td );
     568                                        } // switch
     569                                } // if
     570                                break;
     571                          case DeclarationNode::Double:
     572                                if ( sawDouble ) {
     573                                        throw SemanticError( "duplicate type specifier \"double\" in type: ", td );
     574                                } else {
     575                                        switch ( ret ) {
     576                                          case BasicType::DoubleComplex:
     577                                          case BasicType::DoubleImaginary:
     578                                                break;
     579                                          default:
     580                                                throw SemanticError( "invalid type specifier \"double\" in type: ", td );
     581                                        } // switch
     582                                } // if
     583                                break;
     584                          case DeclarationNode::Complex:
     585                                switch ( ret ) {
     586                                  case BasicType::Float:
     587                                        ret = BasicType::FloatComplex;
     588                                        break;
     589                                  case BasicType::Double:
     590                                        ret = BasicType::DoubleComplex;
     591                                        break;
     592                                  default:
     593                                        throw SemanticError( "invalid type specifier \"_Complex\" in type: ", td );
     594                                } // switch
     595                                break;
     596                          case DeclarationNode::Imaginary:
     597                                switch ( ret ) {
     598                                  case BasicType::Float:
     599                                        ret = BasicType::FloatImaginary;
     600                                        break;
     601                                  case BasicType::Double:
     602                                        ret = BasicType::DoubleImaginary;
     603                                        break;
     604                                  default:
     605                                        throw SemanticError( "invalid type specifier \"_Imaginary\" in type: ", td );
     606                                } // switch
     607                                break;
     608                          default:
     609                                throw SemanticError( std::string( "invalid type specifier \"" ) + DeclarationNode::basicTypeName[ *i ] + "\" in type: ", td );
     610                        } // switch
     611                } // if
     612                if ( *i == DeclarationNode::Double ) {
     613                        sawDouble = true;
     614                } // if
     615        } // for
     616
     617        for ( std::list< DeclarationNode::Modifier >::const_iterator i = td->basic.modifiers.begin(); i != td->basic.modifiers.end(); ++i ) {
     618                switch ( *i ) {
     619                  case DeclarationNode::Long:
     620                        if ( ! init ) {
     621                                init = true;
     622                                ret = BasicType::LongSignedInt;
     623                        } else {
     624                                switch ( ret ) {
     625                                  case BasicType::SignedInt:
     626                                        ret = BasicType::LongSignedInt;
     627                                        break;
     628                                  case BasicType::UnsignedInt:
     629                                        ret = BasicType::LongUnsignedInt;
     630                                        break;
     631                                  case BasicType::LongSignedInt:
     632                                        ret = BasicType::LongLongSignedInt;
     633                                        break;
     634                                  case BasicType::LongUnsignedInt:
     635                                        ret = BasicType::LongLongUnsignedInt;
     636                                        break;
     637                                  case BasicType::Double:
     638                                        ret = BasicType::LongDouble;
     639                                        break;
     640                                  case BasicType::DoubleComplex:
     641                                        ret = BasicType::LongDoubleComplex;
     642                                        break;
     643                                  case BasicType::DoubleImaginary:
     644                                        ret = BasicType::LongDoubleImaginary;
     645                                        break;
     646                                  default:
     647                                        throw SemanticError( "invalid type modifier \"long\" in type: ", td );
     648                                } // switch
     649                        } // if
     650                        break;
     651                  case DeclarationNode::Short:
     652                        if ( ! init ) {
     653                                init = true;
     654                                ret = BasicType::ShortSignedInt;
     655                        } else {
     656                                switch ( ret ) {
     657                                  case BasicType::SignedInt:
     658                                        ret = BasicType::ShortSignedInt;
     659                                        break;
     660                                  case BasicType::UnsignedInt:
     661                                        ret = BasicType::ShortUnsignedInt;
     662                                        break;
     663                                  default:
     664                                        throw SemanticError( "invalid type modifier \"short\" in type: ", td );
     665                                } // switch
     666                        } // if
     667                        break;
     668                  case DeclarationNode::Signed:
     669                        if ( ! init ) {
     670                                init = true;
     671                                ret = BasicType::SignedInt;
     672                        } else if ( sawSigned ) {
     673                                throw SemanticError( "duplicate type modifer \"signed\" in type: ", td );
     674                        } else {
     675                                switch ( ret ) {
     676                                  case BasicType::LongLongSignedInt:
     677                                        ret = BasicType::LongLongUnsignedInt;
     678                                        break;
     679                                  case BasicType::LongSignedInt:
     680                                        ret = BasicType::LongUnsignedInt;
     681                                        break;
     682                                  case BasicType::SignedInt:
     683                                  case BasicType::ShortSignedInt:
     684                                        break;
     685                                  case BasicType::Char:
     686                                        ret = BasicType::SignedChar;
     687                                        break;
     688                                  default:
     689                                        throw SemanticError( "invalid type modifer \"signed\" in type: ", td );
     690                                } // switch
     691                        } // if
     692                        break;
     693                  case DeclarationNode::Unsigned:
     694                        if ( ! init ) {
     695                                init = true;
     696                                ret = BasicType::UnsignedInt;
     697                        } else if ( sawSigned ) {
     698                                throw SemanticError( "invalid type modifer \"unsigned\" in type: ", td );
     699                        } else {
     700                                switch ( ret ) {
     701                                  case BasicType::LongLongSignedInt:
     702                                        ret = BasicType::LongLongUnsignedInt;
     703                                        break;
     704                                  case BasicType::LongSignedInt:
     705                                        ret = BasicType::LongUnsignedInt;
     706                                        break;
     707                                  case BasicType::SignedInt:
     708                                        ret = BasicType::UnsignedInt;
     709                                        break;
     710                                  case BasicType::ShortSignedInt:
     711                                        ret = BasicType::ShortUnsignedInt;
     712                                        break;
     713                                  case BasicType::Char:
     714                                        ret = BasicType::UnsignedChar;
     715                                        break;
     716                                  default:
     717                                        throw SemanticError( "invalid type modifer \"unsigned\" in type: ", td );
     718                                } // switch
     719                        } // if
     720                        break;
     721                } // switch
     722
     723                if ( *i == DeclarationNode::Signed ) {
     724                        sawSigned = true;
     725                } // if
     726        } // for
     727
     728        BasicType * bt;
     729        if ( ! init ) {
     730                bt = new BasicType( buildQualifiers( td ), BasicType::SignedInt );
     731        } else {
     732                bt = new BasicType( buildQualifiers( td ), ret );
     733        } // if
    624734        buildForall( td->forall, bt->get_forall() );
    625735        return bt;
  • src/Parser/TypeData.h

    rfc4a0fa r1eba452  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 17:15:49 2016
    13 // Update Count     : 129
     12// Last Modified On : Sat Sep 10 09:42:54 2016
     13// Update Count     : 118
    1414//
    1515
     
    2525        enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst,
    2626                                Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Builtin, Attr };
     27
     28        struct Basic_t {
     29                std::list< DeclarationNode::BasicType > typeSpec;
     30                std::list< DeclarationNode::Modifier > modifiers;
     31        };
    2732
    2833        struct Aggregate_t {
     
    6873        };
    6974
     75        // struct Tuple_t {
     76        //      DeclarationNode * members;
     77        // };
     78 
     79        // struct Typeof_t {
     80        //      ExpressionNode * expr;
     81        // };
     82
     83        // struct Builtin_t {
     84        //      DeclarationNode::BuiltinType type;
     85        // };
     86
    7087        Kind kind;
    7188        TypeData * base;
    72         DeclarationNode::BasicType basictype = DeclarationNode::NoBasicType;
    73         DeclarationNode::ComplexType complextype = DeclarationNode::NoComplexType;
    74         DeclarationNode::Signedness signedness = DeclarationNode::NoSignedness;
    75         DeclarationNode::Length length = DeclarationNode::NoLength;
    76         typedef std::bitset< DeclarationNode::NoQualifier > Qualifiers;
     89        typedef std::bitset< DeclarationNode::NoOfQualifier > Qualifiers;
    7790        Qualifiers qualifiers;
     91        typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses;
     92        StorageClasses storageclasses;
    7893        DeclarationNode * forall;
    7994
    80                 // Basic_t basic;
     95                Basic_t basic;
    8196                Aggregate_t aggregate;
    8297                AggInst_t aggInst;
  • src/Parser/parser.cc

    rfc4a0fa r1eba452  
    59295929/* Line 1806 of yacc.c  */
    59305930#line 829 "parser.yy"
    5931     { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
     5931    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn) ) ); }
    59325932    break;
    59335933
     
    67446744/* Line 1806 of yacc.c  */
    67456745#line 1365 "parser.yy"
    6746     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
     6746    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Long ); }
    67476747    break;
    67486748
     
    67516751/* Line 1806 of yacc.c  */
    67526752#line 1367 "parser.yy"
    6753     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
     6753    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Short ); }
    67546754    break;
    67556755
     
    67586758/* Line 1806 of yacc.c  */
    67596759#line 1369 "parser.yy"
    6760     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
     6760    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Signed ); }
    67616761    break;
    67626762
     
    67656765/* Line 1806 of yacc.c  */
    67666766#line 1371 "parser.yy"
    6767     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
     6767    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Unsigned ); }
    67686768    break;
    67696769
     
    67866786/* Line 1806 of yacc.c  */
    67876787#line 1377 "parser.yy"
    6788     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     6788    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Complex ); }
    67896789    break;
    67906790
     
    67936793/* Line 1806 of yacc.c  */
    67946794#line 1379 "parser.yy"
    6795     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     6795    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
    67966796    break;
    67976797
     
    75447544/* Line 1806 of yacc.c  */
    75457545#line 1851 "parser.yy"
    7546     { (yyval.tclass) = DeclarationNode::Otype; }
     7546    { (yyval.tclass) = DeclarationNode::Type; }
    75477547    break;
    75487548
  • src/Parser/parser.h

    rfc4a0fa r1eba452  
    1 /* A Bison parser, made by GNU Bison 2.5.  */
     1/* A Bison parser, made by GNU Bison 3.0.2.  */
    22
    33/* Bison interface for Yacc-like parsers in C
    4    
    5       Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
    6    
     4
     5   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
     6
    77   This program is free software: you can redistribute it and/or modify
    88   it under the terms of the GNU General Public License as published by
    99   the Free Software Foundation, either version 3 of the License, or
    1010   (at your option) any later version.
    11    
     11
    1212   This program is distributed in the hope that it will be useful,
    1313   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1414   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1515   GNU General Public License for more details.
    16    
     16
    1717   You should have received a copy of the GNU General Public License
    1818   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     
    2727   Bison output files to be licensed under the GNU General Public
    2828   License without this special exception.
    29    
     29
    3030   This special exception was added by the Free Software Foundation in
    3131   version 2.2 of Bison.  */
    3232
    33 
    34 /* Tokens.  */
     33#ifndef YY_YY_PARSER_PARSER_H_INCLUDED
     34# define YY_YY_PARSER_PARSER_H_INCLUDED
     35/* Debug traces.  */
     36#ifndef YYDEBUG
     37# define YYDEBUG 1
     38#endif
     39#if YYDEBUG
     40extern int yydebug;
     41#endif
     42
     43/* Token type.  */
    3544#ifndef YYTOKENTYPE
    3645# define YYTOKENTYPE
    37    /* Put the tokens into the symbol table, so that GDB and other debuggers
    38       know about them.  */
    39    enum yytokentype {
    40      TYPEDEF = 258,
    41      AUTO = 259,
    42      EXTERN = 260,
    43      REGISTER = 261,
    44      STATIC = 262,
    45      INLINE = 263,
    46      FORTRAN = 264,
    47      CONST = 265,
    48      VOLATILE = 266,
    49      RESTRICT = 267,
    50      FORALL = 268,
    51      LVALUE = 269,
    52      VOID = 270,
    53      CHAR = 271,
    54      SHORT = 272,
    55      INT = 273,
    56      LONG = 274,
    57      FLOAT = 275,
    58      DOUBLE = 276,
    59      SIGNED = 277,
    60      UNSIGNED = 278,
    61      VALIST = 279,
    62      BOOL = 280,
    63      COMPLEX = 281,
    64      IMAGINARY = 282,
    65      TYPEOF = 283,
    66      LABEL = 284,
    67      ENUM = 285,
    68      STRUCT = 286,
    69      UNION = 287,
    70      OTYPE = 288,
    71      FTYPE = 289,
    72      DTYPE = 290,
    73      TRAIT = 291,
    74      SIZEOF = 292,
    75      OFFSETOF = 293,
    76      ATTRIBUTE = 294,
    77      EXTENSION = 295,
    78      IF = 296,
    79      ELSE = 297,
    80      SWITCH = 298,
    81      CASE = 299,
    82      DEFAULT = 300,
    83      DO = 301,
    84      WHILE = 302,
    85      FOR = 303,
    86      BREAK = 304,
    87      CONTINUE = 305,
    88      GOTO = 306,
    89      RETURN = 307,
    90      CHOOSE = 308,
    91      DISABLE = 309,
    92      ENABLE = 310,
    93      FALLTHRU = 311,
    94      TRY = 312,
    95      CATCH = 313,
    96      CATCHRESUME = 314,
    97      FINALLY = 315,
    98      THROW = 316,
    99      THROWRESUME = 317,
    100      AT = 318,
    101      ASM = 319,
    102      ALIGNAS = 320,
    103      ALIGNOF = 321,
    104      ATOMIC = 322,
    105      GENERIC = 323,
    106      NORETURN = 324,
    107      STATICASSERT = 325,
    108      THREADLOCAL = 326,
    109      IDENTIFIER = 327,
    110      QUOTED_IDENTIFIER = 328,
    111      TYPEDEFname = 329,
    112      TYPEGENname = 330,
    113      ATTR_IDENTIFIER = 331,
    114      ATTR_TYPEDEFname = 332,
    115      ATTR_TYPEGENname = 333,
    116      INTEGERconstant = 334,
    117      FLOATINGconstant = 335,
    118      CHARACTERconstant = 336,
    119      STRINGliteral = 337,
    120      ZERO = 338,
    121      ONE = 339,
    122      ARROW = 340,
    123      ICR = 341,
    124      DECR = 342,
    125      LS = 343,
    126      RS = 344,
    127      LE = 345,
    128      GE = 346,
    129      EQ = 347,
    130      NE = 348,
    131      ANDAND = 349,
    132      OROR = 350,
    133      ELLIPSIS = 351,
    134      MULTassign = 352,
    135      DIVassign = 353,
    136      MODassign = 354,
    137      PLUSassign = 355,
    138      MINUSassign = 356,
    139      LSassign = 357,
    140      RSassign = 358,
    141      ANDassign = 359,
    142      ERassign = 360,
    143      ORassign = 361,
    144      ATassign = 362,
    145      THEN = 363
    146    };
     46  enum yytokentype
     47  {
     48    TYPEDEF = 258,
     49    AUTO = 259,
     50    EXTERN = 260,
     51    REGISTER = 261,
     52    STATIC = 262,
     53    INLINE = 263,
     54    FORTRAN = 264,
     55    CONST = 265,
     56    VOLATILE = 266,
     57    RESTRICT = 267,
     58    FORALL = 268,
     59    LVALUE = 269,
     60    VOID = 270,
     61    CHAR = 271,
     62    SHORT = 272,
     63    INT = 273,
     64    LONG = 274,
     65    FLOAT = 275,
     66    DOUBLE = 276,
     67    SIGNED = 277,
     68    UNSIGNED = 278,
     69    VALIST = 279,
     70    BOOL = 280,
     71    COMPLEX = 281,
     72    IMAGINARY = 282,
     73    TYPEOF = 283,
     74    LABEL = 284,
     75    ENUM = 285,
     76    STRUCT = 286,
     77    UNION = 287,
     78    OTYPE = 288,
     79    FTYPE = 289,
     80    DTYPE = 290,
     81    TRAIT = 291,
     82    SIZEOF = 292,
     83    OFFSETOF = 293,
     84    ATTRIBUTE = 294,
     85    EXTENSION = 295,
     86    IF = 296,
     87    ELSE = 297,
     88    SWITCH = 298,
     89    CASE = 299,
     90    DEFAULT = 300,
     91    DO = 301,
     92    WHILE = 302,
     93    FOR = 303,
     94    BREAK = 304,
     95    CONTINUE = 305,
     96    GOTO = 306,
     97    RETURN = 307,
     98    CHOOSE = 308,
     99    DISABLE = 309,
     100    ENABLE = 310,
     101    FALLTHRU = 311,
     102    TRY = 312,
     103    CATCH = 313,
     104    CATCHRESUME = 314,
     105    FINALLY = 315,
     106    THROW = 316,
     107    THROWRESUME = 317,
     108    AT = 318,
     109    ASM = 319,
     110    ALIGNAS = 320,
     111    ALIGNOF = 321,
     112    ATOMIC = 322,
     113    GENERIC = 323,
     114    NORETURN = 324,
     115    STATICASSERT = 325,
     116    THREADLOCAL = 326,
     117    IDENTIFIER = 327,
     118    QUOTED_IDENTIFIER = 328,
     119    TYPEDEFname = 329,
     120    TYPEGENname = 330,
     121    ATTR_IDENTIFIER = 331,
     122    ATTR_TYPEDEFname = 332,
     123    ATTR_TYPEGENname = 333,
     124    INTEGERconstant = 334,
     125    FLOATINGconstant = 335,
     126    CHARACTERconstant = 336,
     127    STRINGliteral = 337,
     128    ZERO = 338,
     129    ONE = 339,
     130    ARROW = 340,
     131    ICR = 341,
     132    DECR = 342,
     133    LS = 343,
     134    RS = 344,
     135    LE = 345,
     136    GE = 346,
     137    EQ = 347,
     138    NE = 348,
     139    ANDAND = 349,
     140    OROR = 350,
     141    ELLIPSIS = 351,
     142    MULTassign = 352,
     143    DIVassign = 353,
     144    MODassign = 354,
     145    PLUSassign = 355,
     146    MINUSassign = 356,
     147    LSassign = 357,
     148    RSassign = 358,
     149    ANDassign = 359,
     150    ERassign = 360,
     151    ORassign = 361,
     152    ATassign = 362,
     153    THEN = 363
     154  };
    147155#endif
    148156/* Tokens.  */
     
    254262#define THEN 363
    255263
    256 
    257 
    258 
     264/* Value type.  */
    259265#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
    260 typedef union YYSTYPE
     266typedef union YYSTYPE YYSTYPE;
     267union YYSTYPE
    261268{
    262 
    263 /* Line 2068 of yacc.c  */
    264 #line 115 "parser.yy"
     269#line 115 "parser.yy" /* yacc.c:1909  */
    265270
    266271        Token tok;
     
    279284        bool flag;
    280285
    281 
    282 
    283 /* Line 2068 of yacc.c  */
    284 #line 285 "Parser/parser.h"
    285 } YYSTYPE;
     286#line 287 "Parser/parser.h" /* yacc.c:1909  */
     287};
    286288# define YYSTYPE_IS_TRIVIAL 1
    287 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
    288289# define YYSTYPE_IS_DECLARED 1
    289290#endif
    290291
     292
    291293extern YYSTYPE yylval;
    292294
    293 
     295int yyparse (void);
     296
     297#endif /* !YY_YY_PARSER_PARSER_H_INCLUDED  */
  • src/Parser/parser.yy

    rfc4a0fa r1eba452  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 17:29:45 2016
    13 // Update Count     : 1969
     12// Last Modified On : Fri Aug 26 16:45:44 2016
     13// Update Count     : 1964
    1414//
    1515
     
    13631363                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    13641364        | LONG
    1365                 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
     1365                { $$ = DeclarationNode::newModifier( DeclarationNode::Long ); }
    13661366        | SHORT
    1367                 { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1367                { $$ = DeclarationNode::newModifier( DeclarationNode::Short ); }
    13681368        | SIGNED
    1369                 { $$ = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
     1369                { $$ = DeclarationNode::newModifier( DeclarationNode::Signed ); }
    13701370        | UNSIGNED
    1371                 { $$ = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
     1371                { $$ = DeclarationNode::newModifier( DeclarationNode::Unsigned ); }
    13721372        | VOID
    13731373                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    13751375                { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    13761376        | COMPLEX                                                                                       // C99
    1377                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     1377                { $$ = DeclarationNode::newBasicType( DeclarationNode::Complex ); }
    13781378        | IMAGINARY                                                                                     // C99
    1379                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     1379                { $$ = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
    13801380        | VALIST                                                                                        // GCC, __builtin_va_list
    13811381                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     
    18491849type_class:                                                                                             // CFA
    18501850        OTYPE
    1851                 { $$ = DeclarationNode::Otype; }
     1851                { $$ = DeclarationNode::Type; }
    18521852        | DTYPE
    18531853                { $$ = DeclarationNode::Ftype; }
  • src/libcfa/limits.c

    rfc4a0fa r1eba452  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 12 10:34:48 2016
    13 // Update Count     : 17
     12// Last Modified On : Fri Jul  8 13:23:33 2016
     13// Update Count     : 14
    1414//
    1515
     
    6363const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
    6464
    65 const double _Complex PI = 3.14159265358979323846_D+0.0_iD;     // pi
    66 const double _Complex PI_2 = 1.57079632679489661923_D+0.0_iD; // pi / 2
    67 const double _Complex PI_4 = 0.78539816339744830962_D+0.0_iD; // pi / 4
    68 const double _Complex _1_PI = 0.31830988618379067154_D+0.0_iD; // 1 / pi
    69 const double _Complex _2_PI = 0.63661977236758134308_D+0.0_iD; // 2 / pi
    70 const double _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
     65const _Complex PI = 3.14159265358979323846_D+0.0_iD;    // pi
     66const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;  // pi / 2
     67const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;  // pi / 4
     68const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD; // 1 / pi
     69const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD; // 2 / pi
     70const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
    7171
    72 const long double _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
    73 const long double _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
    74 const long double _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
    75 const long double _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
    76 const long double _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
    77 const long double _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
     72const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
     73const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
     74const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
     75const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
     76const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
     77const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
    7878
    7979const float E = 2.718281;                                                               // e
     
    101101const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
    102102
    103 const double _Complex E = 2.7182818284590452354_D+0.0_iD; // e
    104 const double _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD; // log_2(e)
    105 const double _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
    106 const double _Complex LN_2 = 0.69314718055994530942_D+0.0_iD; // log_e(2)
    107 const double _Complex LN_10 = 2.30258509299404568402_D+0.0_iD; // log_e(10)
    108 const double _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD; // sqrt(2)
    109 const double _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
     103const _Complex E = 2.7182818284590452354_D+0.0_iD;              // e
     104const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD; // log_2(e)
     105const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
     106const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;  // log_e(2)
     107const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD; // log_e(10)
     108const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD; // sqrt(2)
     109const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
    110110
    111 const long double _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
    112 const long double _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
    113 const long double _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
    114 const long double _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
    115 const long double _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
    116 const long double _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
    117 const long double _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
     111const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
     112const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
     113const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
     114const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
     115const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
     116const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
     117const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
    118118
    119119// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.