Changes in / [be8bd88:87c3bef]


Ignore:
Files:
5 added
57 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rbe8bd88 r87c3bef  
    3030
    3131src/prelude/builtins.cf
    32 src/prelude/builtins.c
    3332src/prelude/extras.cf
    3433src/prelude/bootloader.c
     
    3736# generated by bison and lex from cfa.yy and lex.ll, respectively
    3837src/Parser/parser.output
    39 src/Parser/lex.cc
    40 src/Parser/parser.cc
    41 src/Parser/parser.h
    4238
    4339# generated by xfig for user manual
  • Makefile.in

    rbe8bd88 r87c3bef  
    135135CFA_INCDIR = @CFA_INCDIR@
    136136CFA_LIBDIR = @CFA_LIBDIR@
    137 CFA_NAME = @CFA_NAME@
    138137CFA_PREFIX = @CFA_PREFIX@
    139138CFLAGS = @CFLAGS@
  • configure

    rbe8bd88 r87c3bef  
    668668CFA_BACKEND_CC
    669669BACKEND_CC
    670 CFA_NAME
    671670MAINT
    672671MAINTAINER_MODE_FALSE
     
    742741enable_silent_rules
    743742enable_maintainer_mode
    744 with_cfa_name
    745743with_backend_compiler
    746744enable_target_release
     
    13991397  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    14001398  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
    1401   --with-cfa-name=NAME     NAME too which cfa will be installed
    14021399  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible)
    14031400
     
    30043001                        # may require auto* software to be installed
    30053002
    3006 # Allow program name tansformation
    3007 # will fille program_transform_name with appropriate sed regex
    3008 
    3009 #autoconf escapes $ and \ since automake wiill un-escape them.
    3010 #Since we need to use the sed transform in autoconf we need to manualy un-escape these characters
    3011 name_transform=`echo ${program_transform_name} | sed 's/\\$\\$/\\$/g' | sed 's/\\\\\\\/\\\/g'`
    3012 cfa_name=`echo cfa | sed ${name_transform}`
    3013 cc1_name=`echo cc1 | sed ${name_transform}`
    3014 cpp_name=`echo cfa-cpp | sed ${name_transform}`
    3015 
    3016 #Trasforming cc1 will break compilation
    3017 if ! test "${cc1_name}" = "cc1"; then
    3018     as_fn_error $? "Program transform must not modify cc1.
    3019                 --program-sufix and --program-prefix not supported.
    3020                 Use -program-transform-name='s/cfa$/[Desired name here]/' instead" "$LINENO" 5
    3021 fi
    3022 #We could support transforming cfa-cpp but since it is located in a unique subfolder we don't need to
    3023 if ! test "${cpp_name}" = "cfa-cpp"; then
    3024     as_fn_error $? "Program transform must not modify cfa-cpp.
    3025                 --program-sufix and --program-prefix not supported.
    3026                 Use -program-transform-name='s/cfa$/[Desired name here]/' instead" "$LINENO" 5
    3027 fi
    3028 
    3029 
    3030 # Check whether --with-cfa-name was given.
    3031 if test "${with_cfa_name+set}" = set; then :
    3032   withval=$with_cfa_name; cfa_name=$withval
    3033 else
    3034   cfa_name="cfa"
    3035 fi
    3036 
    3037 
    3038 #Define the new name of the installed command
    3039 CFA_NAME=${cfa_name}
    3040 
    3041 
    30423003rm -f version
    30433004echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
     
    32773238
    32783239if test "$includedir" = '${prefix}/include'; then
    3279         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
     3240        cfa_incdir="${cfa_prefix}/include/cfa"
    32803241else
    32813242        cfa_incdir=${includedir}
     
    33033264
    33043265if test "$libdir" = '${exec_prefix}/lib'; then
    3305         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
     3266        cfa_libdir=${cfa_prefix}/lib
    33063267else
    33073268        cfa_libdir=${libdir}
  • configure.ac

    rbe8bd88 r87c3bef  
    1717AM_INIT_AUTOMAKE
    1818AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
    19 
    20 # Allow program name tansformation
    21 # will fill program_transform_name with appropriate sed regex
    22 AC_ARG_PROGRAM
    23 
    24 #Trasforming cc1 will break compilation
    25 if ! test "${program_transform_name}" = ""; then
    26     AC_MSG_ERROR([Program transform not supported.
    27                 Use --with-cfa-name='[[Desired name here]]' instead])
    28 fi
    29 
    30 AC_ARG_WITH(cfa-name,
    31         [  --with-cfa-name=NAME     NAME too which cfa will be installed],
    32         cfa_name=$withval, cfa_name="cfa")
    33 
    34 #Define the new name of the installed command
    35 AC_SUBST(CFA_NAME, ${cfa_name})
    3619
    3720rm -f version
     
    146129
    147130if test "$includedir" = '${prefix}/include'; then
    148         cfa_incdir="${cfa_prefix}/include/${cfa_name}"
     131        cfa_incdir="${cfa_prefix}/include/cfa"
    149132else
    150133        cfa_incdir=${includedir}
     
    162145
    163146if test "$libdir" = '${exec_prefix}/lib'; then
    164         cfa_libdir="${cfa_prefix}/lib/${cfa_name}"
     147        cfa_libdir=${cfa_prefix}/lib
    165148else
    166149        cfa_libdir=${libdir}
  • src/CodeGen/CodeGenerator.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Mar  5 17:13:33 2017
    13 // Update Count     : 475
     12// Last Modified On : Thu Feb 16 14:56:29 2017
     13// Update Count     : 418
    1414//
    1515
     
    134134
    135135                handleStorageClass( functionDecl );
    136                 DeclarationNode::print_FuncSpec( output, functionDecl->get_funcSpec() );
    137 
     136                if ( functionDecl->get_isInline() ) {
     137                        output << "inline ";
     138                } // if
     139                if ( functionDecl->get_isNoreturn() ) {
     140                        output << "_Noreturn ";
     141                } // if
    138142                output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), pretty );
    139143
     
    831835        }
    832836
     837
    833838        void CodeGenerator::visit( ReturnStmt * returnStmt ) {
    834839                output << "return ";
     
    894899        }
    895900
    896         void CodeGenerator::handleStorageClass( DeclarationWithType * decl ) {
    897                 if ( decl->get_storageClasses().any() ) {
    898                         DeclarationNode::print_StorageClass( output, decl->get_storageClasses() );
    899                 } // if
    900         } // CodeGenerator::handleStorageClass
     901        void CodeGenerator::handleStorageClass( Declaration * decl ) {
     902                switch ( decl->get_storageClass() ) {
     903                  case DeclarationNode::Extern:
     904                        output << "extern ";
     905                        break;
     906                  case DeclarationNode::Static:
     907                        output << "static ";
     908                        break;
     909                  case DeclarationNode::Auto:
     910                        // silently drop storage class
     911                        break;
     912                  case DeclarationNode::Register:
     913                        output << "register ";
     914                        break;
     915                  case DeclarationNode::Inline:
     916                        output << "inline ";
     917                        break;
     918                  case DeclarationNode::Fortran:
     919                        output << "fortran ";
     920                        break;
     921                  case DeclarationNode::Noreturn:
     922                        output << "_Noreturn ";
     923                        break;
     924                  case DeclarationNode::Threadlocal:
     925                        output << "_Thread_local ";
     926                        break;
     927                  case DeclarationNode::NoStorageClass:
     928                        break;
     929                } // switch
     930        }
    901931
    902932        std::string genName( DeclarationWithType * decl ) {
  • src/CodeGen/CodeGenerator.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  1 16:20:04 2017
    13 // Update Count     : 50
     12// Last Modified On : Thu Feb  9 15:06:21 2017
     13// Update Count     : 49
    1414//
    1515
     
    123123
    124124                void printDesignators( std::list< Expression * > & );
    125                 void handleStorageClass( DeclarationWithType *decl );
     125                void handleStorageClass( Declaration *decl );
    126126                void handleAggregate( AggregateDecl *aggDecl );
    127127                void handleTypedef( NamedTypeDecl *namedType );
  • src/CodeGen/FixNames.cc

    rbe8bd88 r87c3bef  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:32:08 2017
    13 // Update Count     : 15
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Mon Apr 11 15:38:10 2016
     13// Update Count     : 1
    1414//
    1515
     
    3939        std::string mangle_main() {
    4040                FunctionType* main_type;
    41                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
    42                                                                                                                                    main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    43                                 };
     41                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl(
     42                        "main",
     43                        DeclarationNode::NoStorageClass,
     44                        LinkageSpec::Cforall,
     45                        main_type = new FunctionType( Type::Qualifiers(), true ),
     46                        nullptr, false, false
     47                ) };
    4448                main_type->get_returnVals().push_back(
    45                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     49                        new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    4650                );
    4751
    48                 auto && name = SymTab::Mangler::mangle( mainDecl.get() );
     52                auto&& name = SymTab::Mangler::mangle( mainDecl.get() );
    4953                // std::cerr << name << std::endl;
    5054                return name;
     
    5256        std::string mangle_main_args() {
    5357                FunctionType* main_type;
    54                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
    55                                                                                                                                    main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    56                                 };
     58                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl(
     59                        "main",
     60                        DeclarationNode::NoStorageClass,
     61                        LinkageSpec::Cforall,
     62                        main_type = new FunctionType( Type::Qualifiers(), false ),
     63                        nullptr, false, false
     64                ) };
    5765                main_type->get_returnVals().push_back(
    58                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     66                        new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5967                );
    6068
    6169                mainDecl->get_functionType()->get_parameters().push_back(
    62                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     70                        new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6371                );
    6472
    6573                mainDecl->get_functionType()->get_parameters().push_back(
    66                         new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0,
     74                        new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0,
    6775                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    6876                        nullptr )
  • src/GenPoly/Box.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:45:59 2017
    13 // Update Count     : 330
     12// Last Modified On : Thu Feb 16 14:57:16 2017
     13// Update Count     : 297
    1414//
    1515
     
    289289                        TypeInstType paramType( Type::Qualifiers(), (*param)->get_name(), *param );
    290290                        std::string paramName = mangleType( &paramType );
    291                         layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    292                         layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     291                        layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     292                        layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    293293                }
    294294        }
     
    298298                // Routines at global scope marked "static" to prevent multiple definitions is separate translation units
    299299                // because each unit generates copies of the default routines for each aggregate.
    300                 FunctionDecl *layoutDecl = new FunctionDecl( layoutofName( typeDecl ),
    301                                                                                                          functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::StaticClass ),
    302                                                                                                          LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ),
    303                                                                                                          std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) );
     300                FunctionDecl *layoutDecl = new FunctionDecl(
     301                        layoutofName( typeDecl ), functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ), true, false );
    304302                layoutDecl->fixUniqueId();
    305303                return layoutDecl;
     
    368366                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    369367
    370                 ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     368                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    371369                layoutFnType->get_parameters().push_back( sizeParam );
    372                 ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     370                ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    373371                layoutFnType->get_parameters().push_back( alignParam );
    374                 ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     372                ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    375373                layoutFnType->get_parameters().push_back( offsetParam );
    376374                addOtypeParams( layoutFnType, otypeParams );
     
    429427                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    430428
    431                 ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     429                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    432430                layoutFnType->get_parameters().push_back( sizeParam );
    433                 ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     431                ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    434432                layoutFnType->get_parameters().push_back( alignParam );
    435433                addOtypeParams( layoutFnType, otypeParams );
     
    537535                                        if ( adapters.find( mangleName ) == adapters.end() ) {
    538536                                                std::string adapterName = makeAdapterName( mangleName );
    539                                                 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr ) ) );
     537                                                adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr ) ) );
    540538                                        } // if
    541539                                } // for
     
    656654
    657655                ObjectDecl *Pass1::makeTemporary( Type *type ) {
    658                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, type, 0 );
     656                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, type, 0 );
    659657                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    660658                        return newObj;
     
    765763                                        Type * newType = param->clone();
    766764                                        if ( env ) env->apply( newType );
    767                                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, newType, 0 );
     765                                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, newType, 0 );
    768766                                        newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
    769767                                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
     
    831829                                makeRetParm( adapter );
    832830                        } // if
    833                         adapter->get_parameters().push_front( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
     831                        adapter->get_parameters().push_front( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
    834832                        return adapter;
    835833                }
     
    912910                        adapterBody->get_kids().push_back( bodyStmt );
    913911                        std::string adapterName = makeAdapterName( mangleName );
    914                         return new FunctionDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, adapterType, adapterBody );
     912                        return new FunctionDecl( adapterName, DeclarationNode::NoStorageClass, LinkageSpec::C, adapterType, adapterBody, false, false );
    915913                }
    916914
     
    12731271                                if ( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
    12741272                                        std::string adapterName = makeAdapterName( mangleName );
    1275                                         paramList.push_front( new ObjectDecl( adapterName, DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
     1273                                        paramList.push_front( new ObjectDecl( adapterName, DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0 ) );
    12761274                                        adaptersDone.insert( adaptersDone.begin(), mangleName );
    12771275                                }
     
    13791377                        std::list< DeclarationWithType *>::iterator last = funcType->get_parameters().begin();
    13801378                        std::list< DeclarationWithType *> inferredParams;
    1381                         ObjectDecl newObj( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
    1382                         ObjectDecl newPtr( "", DeclarationNode::StorageClasses(), LinkageSpec::C, 0,
     1379                        ObjectDecl newObj( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
     1380                        ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0,
    13831381                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    13841382                        for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
     
    16341632
    16351633                ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) {
    1636                         ObjectDecl *newObj = new ObjectDecl( name, DeclarationNode::StorageClasses(), LinkageSpec::C, 0, type, init );
     1634                        ObjectDecl *newObj = new ObjectDecl( name, DeclarationNode::NoStorageClass, LinkageSpec::C, 0, type, init );
    16371635                        stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
    16381636                        return newObj;
     
    18181816                                                        memberDecl = origMember->clone();
    18191817                                                } else {
    1820                                                         memberDecl = new ObjectDecl( (*member)->get_name(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, offsetType->clone(), 0 );
     1818                                                        memberDecl = new ObjectDecl( (*member)->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, offsetType->clone(), 0 );
    18211819                                                }
    18221820                                                inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );
  • src/GenPoly/Specialize.cc

    rbe8bd88 r87c3bef  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:13:00 2017
    13 // Update Count     : 30
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Apr 28 15:17:45 2016
     13// Update Count     : 24
    1414//
    1515
     
    155155                } // if
    156156                // create new thunk with same signature as formal type (C linkage, empty body)
    157                 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, newType, new CompoundStmt( noLabels ) );
     157                FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, newType, new CompoundStmt( noLabels ), false, false );
    158158                thunkFunc->fixUniqueId();
    159159
  • src/InitTweak/FixGlobalInit.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 04 15:14:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:14:19 2017
    13 // Update Count     : 14
     12// Last Modified On : Wed Jun 29 22:33:15 2016
     13// Update Count     : 4
    1414//
    1515
     
    8787                        dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) );
    8888                }
    89                 initFunction = new FunctionDecl( "_init_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     89                initFunction = new FunctionDecl( "_init_" + fixedName, DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );
    9090                initFunction->get_attributes().push_back( new Attribute( "constructor", ctorParameters ) );
    91                 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     91                destroyFunction = new FunctionDecl( "_destroy_" + fixedName, DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );
    9292                destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) );
    9393        }
  • src/InitTweak/FixInit.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:51:40 2017
    13 // Update Count     : 59
     12// Last Modified On : Thu Feb 16 14:58:43 2017
     13// Update Count     : 35
    1414//
    1515
     
    437437                        result = result->clone();
    438438                        env->apply( result );
    439                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     439                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
    440440                        tmp->get_type()->set_isConst( false );
    441441
     
    483483                                result = result->clone();
    484484                                env->apply( result );
    485                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     485                                ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
    486486                                ret->get_type()->set_isConst( false );
    487487                                impCpCtorExpr->get_returnDecls().push_back( ret );
     
    506506                                result = result->clone();
    507507                                env->apply( result );
    508                                 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, result, 0 );
     508                                ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
    509509                                ret->get_type()->set_isConst( false );
    510510                                stmtExpr->get_returnDecls().push_front( ret );
     
    538538                        } else {
    539539                                // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    540                                 unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
     540                                unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
    541541                                unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    542542                        }
     
    678678                                assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
    679679                                if ( Statement * ctor = ctorInit->get_ctor() ) {
    680                                         if ( objDecl->get_storageClasses()[ DeclarationNode::Static ] ) {
     680                                        if ( objDecl->get_storageClass() == DeclarationNode::Static ) {
    681681                                                // originally wanted to take advantage of gcc nested functions, but
    682682                                                // we get memory errors with this approach. To remedy this, the static
     
    704704                                                BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    705705                                                SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators );
    706                                                 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );
     706                                                ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::Static, LinkageSpec::Cforall, 0, boolType, boolInitExpr );
    707707                                                isUninitializedVar->fixUniqueId();
    708708
     
    731731
    732732                                                        // void __objName_dtor_atexitN(...) {...}
    733                                                         FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     733                                                        FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );
    734734                                                        dtorCaller->fixUniqueId();
    735735                                                        dtorCaller->get_statements()->push_back( dtorStmt );
     
    764764                                                        // create a new object which is never used
    765765                                                        static UniqueName dummyNamer( "_dummy" );
    766                                                         ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
     766                                                        ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::Static, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
    767767                                                        return dummy;
    768768                                                }
     
    821821                void InsertDtors::visit( ObjectDecl * objDecl ) {
    822822                        // remember non-static destructed objects so that their destructors can be inserted later
    823                         if ( ! objDecl->get_storageClasses()[ DeclarationNode::Static ] ) {
     823                        if ( objDecl->get_storageClass() != DeclarationNode::Static ) {
    824824                                if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) {
    825825                                        // a decision should have been made by the resolver, so ctor and init are not both non-NULL
     
    11181118
    11191119                        // xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary.
    1120                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
     1120                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
    11211121                        addDeclaration( tmp );
    11221122
  • src/InitTweak/GenInit.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:51:38 2017
    13 // Update Count     : 179
     12// Last Modified On : Thu Feb 16 14:57:53 2017
     13// Update Count     : 167
    1414//
    1515
     
    120120                void hoist( Type * type );
    121121
    122                 DeclarationNode::StorageClasses storageClasses;
     122                DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass;
    123123                bool inFunction = false;
    124124        };
     
    174174
    175175        DeclarationWithType * HoistArrayDimension::mutate( ObjectDecl * objectDecl ) {
    176                 storageClasses = objectDecl->get_storageClasses();
     176                storageclass = objectDecl->get_storageClass();
    177177                DeclarationWithType * temp = Parent::mutate( objectDecl );
    178178                hoist( objectDecl->get_type() );
     179                storageclass = DeclarationNode::NoStorageClass;
    179180                return temp;
    180181        }
     
    184185                static UniqueName dimensionName( "_array_dim" );
    185186
    186                 // C doesn't allow variable sized arrays at global scope or for static variables, so don't hoist dimension.
     187                // C doesn't allow variable sized arrays at global scope or for static variables,
     188                // so don't hoist dimension.
    187189                if ( ! inFunction ) return;
    188                 if ( storageClasses[ DeclarationNode::StaticClass] ) return;
     190                if ( storageclass == DeclarationNode::Static ) return;
    189191
    190192                if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
    191193                        if ( ! arrayType->get_dimension() ) return; // xxx - recursive call to hoist?
    192194
    193                         // don't need to hoist dimension if it's a constexpr - only need to if there's potential for side effects.
     195                        // don't need to hoist dimension if it's a constexpr - only need to if there's potential
     196                        // for side effects.
    194197                        if ( isConstExpr( arrayType->get_dimension() ) ) return;
    195198
    196                         ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageClasses, LinkageSpec::C, 0, SymTab::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );
     199                        ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageclass, LinkageSpec::C, 0, SymTab::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );
    197200                        arrayDimension->get_type()->set_isConst( true );
    198201
  • src/InitTweak/InitTweak.cc

    rbe8bd88 r87c3bef  
    260260                        (objDecl->get_init() == NULL ||
    261261                                ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() ))
    262                         && ! objDecl->get_storageClasses()[ DeclarationNode::Extern ];
     262                        && objDecl->get_storageClass() != DeclarationNode::Extern;
    263263        }
    264264
  • src/Makefile.am

    rbe8bd88 r87c3bef  
    3838
    3939# put into lib for now
    40 cfa_cpplibdir = ${CFA_LIBDIR}
     40cfa_cpplibdir = ${libdir}
    4141cfa_cpplib_PROGRAMS = driver/cfa-cpp
    4242driver_cfa_cpp_SOURCES = ${SRC}
  • src/Makefile.in

    rbe8bd88 r87c3bef  
    276276CFA_INCDIR = @CFA_INCDIR@
    277277CFA_LIBDIR = @CFA_LIBDIR@
    278 CFA_NAME = @CFA_NAME@
    279278CFA_PREFIX = @CFA_PREFIX@
    280279CFLAGS = @CFLAGS@
     
    437436
    438437# put into lib for now
    439 cfa_cpplibdir = ${CFA_LIBDIR}
     438cfa_cpplibdir = ${libdir}
    440439driver_cfa_cpp_SOURCES = ${SRC}
    441440driver_cfa_cpp_LDADD = ${LEXLIB} -ldl                   # yywrap
  • src/Parser/DeclarationNode.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 08:02:09 2017
    13 // Update Count     : 936
     12// Last Modified On : Thu Feb 23 22:21:06 2017
     13// Update Count     : 775
    1414//
    1515
     
    1919#include <algorithm>
    2020#include <cassert>
    21 #include <strings.h>                                                                    // ffs
    2221
    2322#include "TypeData.h"
     
    3332
    3433// These must remain in the same order as the corresponding DeclarationNode enumerations.
    35 const char * DeclarationNode::storageClassNames[] = { "extern", "static", "auto", "register", "_Thread_local", "NoStorageClassNames" };
    36 const char * DeclarationNode::funcSpecifierNames[] = { "inline", "fortran", "_Noreturn", "NoFunctionSpecifierNames" };
    37 const char * DeclarationNode::typeQualifierNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic", "NoTypeQualifierNames" };
    38 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicTypeNames" };
    39 const char * DeclarationNode::complexTypeNames[] = { "_Complex", "_Imaginary", "NoComplexTypeNames" };
    40 const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    41 const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
    42 const char * DeclarationNode::aggregateNames[] = { "struct", "union", "context", "NoAggregateNames" };
    43 const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    44 const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "NoBuiltinTypeNames" };
     34const char * DeclarationNode::storageName[] = { "extern", "static", "auto", "register", "inline", "fortran", "_Noreturn", "_Thread_local", "NoStorageClass" };
     35const char * DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue", "_Atomic", "NoQualifier" };
     36const char * DeclarationNode::basicTypeName[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicType" };
     37const char * DeclarationNode::complexTypeName[] = { "_Complex", "_Imaginary", "NoComplexType" };
     38const char * DeclarationNode::signednessName[] = { "signed", "unsigned", "NoSignedness" };
     39const char * DeclarationNode::lengthName[] = { "short", "long", "long long", "NoLength" };
     40const char * DeclarationNode::aggregateName[] = { "struct", "union", "context" };
     41const char * DeclarationNode::typeClassName[] = { "otype", "dtype", "ftype" };
     42const char * DeclarationNode::builtinTypeName[] = { "__builtin_va_list" };
    4543
    4644UniqueName DeclarationNode::anonymous( "__anonymous" );
     
    5048DeclarationNode::DeclarationNode() :
    5149                type( nullptr ),
     50                storageClass( NoStorageClass ),
    5251                bitfieldWidth( nullptr ),
     52                isInline( false ),
     53                isNoreturn( false ),
    5354                hasEllipsis( false ),
    5455                linkage( ::linkage ),
     
    8990
    9091        newnode->type = maybeClone( type );
    91         newnode->storageClasses = storageClasses;
     92        newnode->storageClass = storageClass;
    9293        newnode->bitfieldWidth = maybeClone( bitfieldWidth );
    93         newnode->funcSpecs = funcSpecs;
     94        newnode->isInline = isInline;
     95        newnode->isNoreturn = isNoreturn;
    9496        newnode->enumeratorValue.reset( maybeClone( enumeratorValue.get() ) );
    9597        newnode->hasEllipsis = hasEllipsis;
     
    116118}
    117119
    118 void DeclarationNode::print_StorageClass( std::ostream & output, StorageClasses storageClasses ) {
    119         if ( storageClasses.any() ) {                                                           // function specifiers?
    120                 for ( unsigned int i = 0; i < DeclarationNode::NoStorageClass; i += 1 ) {
    121                         if ( storageClasses[i] ) {
    122                                 output << DeclarationNode::storageClassNames[i] << ' ';
    123                         } // if
    124                 } // for
    125         } // if
    126 } // print_StorageClass
    127 
    128 void DeclarationNode::print_FuncSpec( std::ostream & output, DeclarationNode::FuncSpecifiers funcSpec ) {
    129         if ( funcSpec.any() ) {                                                         // function specifiers?
    130                 for ( unsigned int i = 0; i < DeclarationNode::NoFuncSpecifier; i += 1 ) {
    131                         if ( funcSpec[i] ) {
    132                                 output << DeclarationNode::funcSpecifierNames[i] << ' ';
    133                         } // if
    134                 } // for
    135         } // if
    136 } // print_FuncSpec
    137 
    138120void DeclarationNode::print( std::ostream &os, int indent ) const {
    139121        os << string( indent, ' ' );
     
    148130        } // if
    149131
    150         print_StorageClass( os, storageClasses );
    151         print_FuncSpec( os, funcSpecs );
    152 
     132        if ( storageClass != NoStorageClass ) os << DeclarationNode::storageName[storageClass] << ' ';
     133        if ( isInline ) os << DeclarationNode::storageName[Inline] << ' ';
     134        if ( isNoreturn ) os << DeclarationNode::storageName[Noreturn] << ' ';
    153135        if ( type ) {
    154136                type->print( os, indent );
     
    201183} // DeclarationNode::newFunction
    202184
     185DeclarationNode * DeclarationNode::newQualifier( Qualifier q ) {
     186        DeclarationNode * newnode = new DeclarationNode;
     187        newnode->type = new TypeData();
     188        newnode->type->qualifiers[ q ] = 1;
     189        return newnode;
     190} // DeclarationNode::newQualifier
     191
     192DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) {
     193        DeclarationNode * newnode = new DeclarationNode;
     194        newnode->type = new TypeData( TypeData::Unknown );
     195        newnode->type->forall = forall;
     196        return newnode;
     197} // DeclarationNode::newForall
    203198
    204199DeclarationNode * DeclarationNode::newStorageClass( DeclarationNode::StorageClass sc ) {
    205200        DeclarationNode * newnode = new DeclarationNode;
    206         newnode->storageClasses[ sc ] = true;
     201        newnode->storageClass = sc;
    207202        return newnode;
    208203} // DeclarationNode::newStorageClass
    209 
    210 DeclarationNode * DeclarationNode::newFuncSpecifier( DeclarationNode::FuncSpecifier fs ) {
    211         DeclarationNode * newnode = new DeclarationNode;
    212         newnode->funcSpecs[ fs ] = true;
    213         return newnode;
    214 } // DeclarationNode::newFuncSpecifier
    215 
    216 DeclarationNode * DeclarationNode::newTypeQualifier( TypeQualifier tq ) {
    217         DeclarationNode * newnode = new DeclarationNode;
    218         newnode->type = new TypeData();
    219         newnode->type->typeQualifiers[ tq ] = true;
    220         return newnode;
    221 } // DeclarationNode::newQualifier
    222204
    223205DeclarationNode * DeclarationNode::newBasicType( BasicType bt ) {
     
    248230        return newnode;
    249231} // DeclarationNode::newLength
    250 
    251 DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) {
    252         DeclarationNode * newnode = new DeclarationNode;
    253         newnode->type = new TypeData( TypeData::Unknown );
    254         newnode->type->forall = forall;
    255         return newnode;
    256 } // DeclarationNode::newForall
    257232
    258233DeclarationNode * DeclarationNode::newFromTypedef( string * name ) {
     
    453428
    454429void DeclarationNode::checkQualifiers( const TypeData * src, const TypeData * dst ) {
    455         const TypeData::TypeQualifiers qsrc = src->typeQualifiers, qdst = dst->typeQualifiers; // optimization
     430        TypeData::Qualifiers qsrc = src->qualifiers, qdst = dst->qualifiers; // optimization
    456431
    457432        if ( (qsrc & qdst).any() ) {                                            // common qualifier ?
    458                 for ( unsigned int i = 0; i < NoTypeQualifier; i += 1 ) { // find common qualifiers
     433                for ( int i = 0; i < NoQualifier; i += 1 ) {    // find common qualifiers
    459434                        if ( qsrc[i] && qdst[i] ) {
    460                                 appendError( error, string( "duplicate " ) + DeclarationNode::typeQualifierNames[i] );
     435                                appendError( error, string( "duplicate " ) + DeclarationNode::qualifierName[i] );
    461436                        } // if
    462437                } // for
    463         } // for
     438        } // if
    464439} // DeclarationNode::checkQualifiers
    465440
    466 void DeclarationNode::checkSpecifiers( DeclarationNode * src ) {
    467         if ( (funcSpecs & src->funcSpecs).any() ) {                     // common specifier ?
    468                 for ( unsigned int i = 0; i < NoFuncSpecifier; i += 1 ) { // find common specifier
    469                         if ( funcSpecs[i] && src->funcSpecs[i] ) {
    470                                 appendError( error, string( "duplicate " ) + DeclarationNode::funcSpecifierNames[i] );
    471                         } // if
    472                 } // for
    473         } // if
    474 
    475         if ( storageClasses != 0 && src->storageClasses != 0 ) { // any reason to check ?
    476                 if ( (storageClasses & src->storageClasses).any() ) { // duplicates ?
    477                         for ( unsigned int i = 0; i < NoStorageClass; i += 1 ) { // find duplicates
    478                                 if ( storageClasses[i] && src->storageClasses[i] ) {
    479                                         appendError( error, string( "duplicate " ) + storageClassNames[i] );
    480                                 } // if
    481                         } // for
    482                         // src is the new item being added and has a single bit
    483                 } else if ( ! src->storageClasses[ Threadlocal ] ) { // conflict ?
    484                         appendError( error, string( "conflicting " ) + storageClassNames[ffs( storageClasses.to_ulong() ) - 1] +
    485                                                  " & " + storageClassNames[ffs( src->storageClasses.to_ulong() ) - 1] );
    486                         src->storageClasses.reset();                            // FIX to preserve invariant of one basic storage specifier
    487                 } // if
    488         } // if
    489 
    490         appendError( error, src->error );
    491 } // DeclarationNode::checkSpecifiers
    492 
    493 DeclarationNode * DeclarationNode::copySpecifiers( DeclarationNode * q ) {
    494         funcSpecs = funcSpecs | q->funcSpecs;
    495         storageClasses = storageClasses | q->storageClasses;
     441void DeclarationNode::checkStorageClasses( DeclarationNode * q ) {
     442        if ( storageClass != NoStorageClass && q->storageClass != NoStorageClass ) {
     443                if ( storageClass == q->storageClass ) {                // duplicate qualifier
     444                        appendError( error, string( "duplicate " ) + storageName[ storageClass ] );
     445                } else {                                                                                // only one storage class
     446                        appendError( error, string( "conflicting " ) + storageName[ storageClass ] + " & " + storageName[ q->storageClass ] );
     447                        q->storageClass = storageClass;                         // FIX ERROR, prevent assertions from triggering
     448                } // if
     449        } // if
     450        appendError( error, q->error );
     451} // DeclarationNode::checkStorageClasses
     452
     453DeclarationNode * DeclarationNode::copyStorageClasses( DeclarationNode * q ) {
     454        isInline = isInline || q->isInline;
     455        isNoreturn = isNoreturn || q->isNoreturn;
     456        // do not overwrite an existing value with NoStorageClass
     457        if ( q->storageClass != NoStorageClass ) {
     458                assert( storageClass == NoStorageClass || storageClass == q->storageClass );
     459                storageClass = q->storageClass;
     460        } // if
    496461
    497462        for ( Attribute *attr: reverseIterate( q->attributes ) ) {
     
    499464        } // for
    500465        return this;
    501 } // DeclarationNode::copySpecifiers
     466} // DeclarationNode::copyStorageClasses
    502467
    503468static void addQualifiersToType( TypeData *&src, TypeData * dst ) {
     
    516481                src = nullptr;
    517482        } else {
    518                 dst->typeQualifiers |= src->typeQualifiers;
     483                dst->qualifiers |= src->qualifiers;
    519484        } // if
    520485} // addQualifiersToType
     
    523488        if ( ! q ) { delete q; return this; }
    524489
    525         checkSpecifiers( q );
    526         copySpecifiers( q );
     490        checkStorageClasses( q );
     491        copyStorageClasses( q );
    527492
    528493        if ( ! q->type ) {
     
    553518        } // if
    554519
    555         checkQualifiers( type, q->type );
     520        checkQualifiers( q->type, type );
    556521        addQualifiersToType( q->type, type );
    557522
     
    574539                switch ( dst->kind ) {
    575540                  case TypeData::Unknown:
    576                         src->typeQualifiers |= dst->typeQualifiers;
     541                        src->qualifiers |= dst->qualifiers;
    577542                        dst = src;
    578543                        src = nullptr;
    579544                        break;
    580545                  case TypeData::Basic:
    581                         dst->typeQualifiers |= src->typeQualifiers;
     546                        dst->qualifiers |= src->qualifiers;
    582547                        if ( src->kind != TypeData::Unknown ) {
    583548                                assert( src->kind == TypeData::Basic );
     
    586551                                        dst->basictype = src->basictype;
    587552                                } else if ( src->basictype != DeclarationNode::NoBasicType )
    588                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: ", src );
     553                                        throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::basicTypeName[ src->basictype ] + " in type: ", src );
    589554
    590555                                if ( dst->complextype == DeclarationNode::NoComplexType ) {
    591556                                        dst->complextype = src->complextype;
    592557                                } else if ( src->complextype != DeclarationNode::NoComplexType )
    593                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: ", src );
     558                                        throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::complexTypeName[ src->complextype ] + " in type: ", src );
    594559
    595560                                if ( dst->signedness == DeclarationNode::NoSignedness ) {
    596561                                        dst->signedness = src->signedness;
    597562                                } else if ( src->signedness != DeclarationNode::NoSignedness )
    598                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: ", src );
     563                                        throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::signednessName[ src->signedness ] + " in type: ", src );
    599564
    600565                                if ( dst->length == DeclarationNode::NoLength ) {
     
    603568                                        dst->length = DeclarationNode::LongLong;
    604569                                } else if ( src->length != DeclarationNode::NoLength )
    605                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: ", src );
     570                                        throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::lengthName[ src->length ] + " in type: ", src );
    606571                        } // if
    607572                        break;
     
    615580                                        dst->base->aggInst.params = maybeClone( src->aggregate.actuals );
    616581                                } // if
    617                                 dst->base->typeQualifiers |= src->typeQualifiers;
     582                                dst->base->qualifiers |= src->qualifiers;
    618583                                src = nullptr;
    619584                                break;
     
    634599DeclarationNode * DeclarationNode::addType( DeclarationNode * o ) {
    635600        if ( o ) {
    636                 checkSpecifiers( o );
    637                 copySpecifiers( o );
     601                checkStorageClasses( o );
     602                copyStorageClasses( o );
    638603                if ( o->type ) {
    639604                        if ( ! type ) {
     
    647612                                                type->aggInst.hoistType = o->type->enumeration.body;
    648613                                        } // if
    649                                         type->typeQualifiers |= o->type->typeQualifiers;
     614                                        type->qualifiers |= o->type->qualifiers;
    650615                                } else {
    651616                                        type = o->type;
     
    803768                                        p->type->base->aggInst.params = maybeClone( type->aggregate.actuals );
    804769                                } // if
    805                                 p->type->base->typeQualifiers |= type->typeQualifiers;
     770                                p->type->base->qualifiers |= type->qualifiers;
    806771                                break;
    807772
     
    840805                                        lastArray->base->aggInst.params = maybeClone( type->aggregate.actuals );
    841806                                } // if
    842                                 lastArray->base->typeQualifiers |= type->typeQualifiers;
     807                                lastArray->base->qualifiers |= type->qualifiers;
    843808                                break;
    844809                          default:
     
    889854        DeclarationNode * newnode = new DeclarationNode;
    890855        newnode->type = maybeClone( type );
    891         newnode->copySpecifiers( this );
     856        assert( storageClass == NoStorageClass );
     857        newnode->copyStorageClasses( this );
    892858        assert( newName );
    893859        newnode->name = newName;
     
    898864        if ( ! o ) return nullptr;
    899865
    900         o->copySpecifiers( this );
     866        o->copyStorageClasses( this );
    901867        if ( type ) {
    902868                TypeData * srcType = type;
     
    990956                                } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {
    991957                                        StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
    992                                         auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );
     958                                        auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
    993959                                        obj->location = cur->location;
    994960                                        * out++ = obj;
     
    996962                                } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
    997963                                        UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
    998                                         auto obj = new ObjectDecl( "", DeclarationNode::StorageClasses(), linkage, nullptr, inst, nullptr );
     964                                        auto obj = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr );
    999965                                        obj->location = cur->location;
    1000966                                        * out++ = obj;
     
    10391005        } // if
    10401006
     1007//      if ( variable.name ) {
    10411008        if ( variable.tyClass != NoTypeClass ) {
    10421009                static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    10431010                assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
    10441011                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1045                 TypeDecl * ret = new TypeDecl( *name, DeclarationNode::StorageClasses(), nullptr, kindMap[ variable.tyClass ] );
     1012//              TypeDecl * ret = new TypeDecl( *variable.name, DeclarationNode::NoStorageClass, nullptr, kindMap[ variable.tyClass ] );
     1013                TypeDecl * ret = new TypeDecl( *name, DeclarationNode::NoStorageClass, nullptr, kindMap[ variable.tyClass ] );
    10461014                buildList( variable.assertions, ret->get_assertions() );
    10471015                return ret;
     
    10491017
    10501018        if ( type ) {
    1051                 // Function specifiers can only appear on a function definition/declaration.
    1052                 //
    1053                 //    inline _Noreturn int f();                 // allowed
    1054                 //    inline _Noreturn int g( int i );  // allowed
    1055                 //    inline _Noreturn int i;                   // disallowed
    1056                 if ( type->kind != TypeData::Function && funcSpecs.any() ) {
    1057                         throw SemanticError( "invalid function specifier for ", this );
    1058                 } // if
    1059                 return buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
    1060         } // if
    1061 
    1062         // SUE's cannot have function specifiers, either
    1063         //
    1064         //    inlne _Noreturn struct S { ... };         // disallowed
    1065         //    inlne _Noreturn enum   E { ... };         // disallowed
    1066         if ( funcSpecs.any() ) {
    1067                 throw SemanticError( "invalid function specifier for ", this );
    1068         } // if
    1069         assertf( name, "ObjectDecl must a have name\n" );
    1070         return (new ObjectDecl( *name, storageClasses, linkage, maybeBuild< Expression >( bitfieldWidth ), nullptr, maybeBuild< Initializer >( initializer ) ))->set_asmName( asmName )->set_extension( extension );
     1019                return buildDecl( type, name ? *name : string( "" ), storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
     1020        } // if
     1021
     1022        if ( ! isInline && ! isNoreturn ) {
     1023                assertf( name, "ObjectDecl are assumed to have names\n" );
     1024                return (new ObjectDecl( *name, storageClass, linkage, maybeBuild< Expression >( bitfieldWidth ), nullptr, maybeBuild< Initializer >( initializer ) ))->set_asmName( asmName )->set_extension( extension );
     1025        } // if
     1026
     1027        throw SemanticError( "invalid function specifier ", this );
    10711028}
    10721029
     
    10751032
    10761033        if ( attr.expr ) {
     1034//              return new AttrType( buildQualifiers( type ), *attr.name, attr.expr->build() );
    10771035                return new AttrType( buildQualifiers( type ), *name, attr.expr->build(), attributes );
    10781036        } else if ( attr.type ) {
     1037//              return new AttrType( buildQualifiers( type ), *attr.name, attr.type->buildType() );
    10791038                return new AttrType( buildQualifiers( type ), *name, attr.type->buildType(), attributes );
    10801039        } // if
  • src/Parser/ExpressionNode.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Mar  4 06:58:47 2017
    13 // Update Count     : 509
     12// Last Modified On : Fri Sep 16 16:27:44 2016
     13// Update Count     : 508
    1414//
    1515
     
    173173
    174174Expression *build_constantZeroOne( const std::string & str ) {
    175         Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str ) );
     175        Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type*)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str ) );
    176176        delete &str;                                                                            // created by lex
    177177        return ret;
     
    275275}
    276276Expression *build_offsetOf( DeclarationNode *decl_node, NameExpr *member ) {
    277         Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
     277        Expression* ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
    278278        delete member;
    279279        return ret;
  • src/Parser/ParseNode.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 08:10:53 2017
    13 // Update Count     : 726
     12// Last Modified On : Thu Feb 23 15:22:10 2017
     13// Update Count     : 662
    1414//
    1515
     
    1919#include <string>
    2020#include <list>
    21 #include <bitset>
    2221#include <iterator>
    2322#include <memory>
     
    4039//##############################################################################
    4140
    42 extern char * yyfilename;
     41extern char* yyfilename;
    4342extern int yylineno;
    4443
     
    123122        }
    124123
    125         Expression * build() const { return const_cast<ExpressionNode *>(this)->expr.release(); }
     124        Expression * build() const { return const_cast<ExpressionNode*>(this)->expr.release(); }
    126125  private:
    127126        bool extension = false;
     
    204203        // These must remain in the same order as the corresponding DeclarationNode names.
    205204
    206         enum StorageClass { Extern, Static, Auto, Register, Threadlocal, NoStorageClass,
    207                                                 ExternClass = 1 << Extern, StaticClass = 1 << Static, AutoClass = 1 << Auto, RegisterClass = 1 << Register, ThreadlocalClass = 1 << Threadlocal };
    208         enum FuncSpecifier { Inline, Noreturn, Fortran, NoFuncSpecifier,
    209                                                  InlineSpec = 1 << Inline, NoreturnSpec = 1 << Noreturn, FortranSpec = 1 << Fortran };
    210         enum TypeQualifier { Const, Restrict, Volatile, Lvalue, Mutex, Atomic, NoTypeQualifier };
     205        // enum StorageClass { Extern, Static, Auto, Register, NoStorageClass };
     206        // enum FunctionSpec { Inline, Fortran, Noreturn, NoFunctionSpec };
     207        // enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, Threadlocal, Mutex, NoQualifier };
     208
     209        enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, };
     210        enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic, NoQualifier };
    211211        enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType };
    212212        enum ComplexType { Complex, Imaginary, NoComplexType };
     
    217217        enum BuiltinType { Valist, Zero, One, NoBuiltinType };
    218218
    219         static const char * storageClassNames[];
    220         static const char * funcSpecifierNames[];
    221         static const char * typeQualifierNames[];
    222         static const char * basicTypeNames[];
    223         static const char * complexTypeNames[];
    224         static const char * signednessNames[];
    225         static const char * lengthNames[];
    226         static const char * aggregateNames[];
    227         static const char * typeClassNames[];
    228         static const char * builtinTypeNames[];
    229 
     219        static const char * storageName[];
     220        static const char * qualifierName[];
     221        static const char * basicTypeName[];
     222        static const char * complexTypeName[];
     223        static const char * signednessName[];
     224        static const char * lengthName[];
     225        static const char * aggregateName[];
     226        static const char * typeClassName[];
     227        static const char * builtinTypeName[];
     228
     229        static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
     230        static DeclarationNode * newQualifier( Qualifier );
     231        static DeclarationNode * newForall( DeclarationNode * );
    230232        static DeclarationNode * newStorageClass( StorageClass );
    231         static DeclarationNode * newFuncSpecifier( FuncSpecifier );
    232         static DeclarationNode * newTypeQualifier( TypeQualifier );
    233233        static DeclarationNode * newBasicType( BasicType );
    234234        static DeclarationNode * newComplexType( ComplexType );
    235         static DeclarationNode * newSignedNess( Signedness );
    236         static DeclarationNode * newLength( Length );
     235        static DeclarationNode * newSignedNess( Signedness sn );
     236        static DeclarationNode * newLength( Length lnth );
    237237        static DeclarationNode * newBuiltinType( BuiltinType );
    238         static DeclarationNode * newForall( DeclarationNode * );
    239238        static DeclarationNode * newFromTypedef( std::string * );
    240         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
    241239        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    242240        static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
     
    265263        DeclarationNode * addQualifiers( DeclarationNode * );
    266264        void checkQualifiers( const TypeData *, const TypeData * );
    267         void checkSpecifiers( DeclarationNode * );
    268         DeclarationNode * copySpecifiers( DeclarationNode * );
     265        void checkStorageClasses( DeclarationNode * );
     266        DeclarationNode * copyStorageClasses( DeclarationNode * );
    269267        DeclarationNode * addType( DeclarationNode * );
    270268        DeclarationNode * addTypedef();
     
    297295
    298296        Declaration * build() const;
    299         Type * buildType() const;
     297        ::Type * buildType() const;
    300298
    301299        bool get_hasEllipsis() const;
     
    303301        DeclarationNode * extractAggregate() const;
    304302        bool has_enumeratorValue() const { return (bool)enumeratorValue; }
    305         ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode *>(this)->enumeratorValue.release(); }
     303        ExpressionNode * consume_enumeratorValue() const { return const_cast<DeclarationNode*>(this)->enumeratorValue.release(); }
    306304
    307305        bool get_extension() const { return extension; }
     
    325323
    326324        TypeData * type;
    327 
    328         typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses;
    329         StorageClasses storageClasses;
    330         static void print_StorageClass( std::ostream & output, StorageClasses storageClasses );
    331 
    332         typedef std::bitset< DeclarationNode::NoFuncSpecifier > FuncSpecifiers;
    333         FuncSpecifiers funcSpecs;
    334         static void print_FuncSpec( std::ostream & output, FuncSpecifiers funcSpecs );
    335 
     325        StorageClass storageClass;
    336326        ExpressionNode * bitfieldWidth;
     327        bool isInline, isNoreturn;
    337328        std::unique_ptr<ExpressionNode> enumeratorValue;
    338329        bool hasEllipsis;
     
    351342
    352343static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) {
    353         Type * ret = orig ? orig->buildType() : nullptr;
     344        Type* ret = orig ? orig->buildType() : nullptr;
    354345        delete orig;
    355346        return ret;
     
    366357
    367358        virtual StatementNode * clone() const final { assert( false ); return nullptr; }
    368         Statement * build() const { return const_cast<StatementNode *>(this)->stmt.release(); }
     359        Statement * build() const { return const_cast<StatementNode*>(this)->stmt.release(); }
    369360
    370361        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
  • src/Parser/TypeData.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 08:08:21 2017
    13 // Update Count     : 538
     12// Last Modified On : Thu Feb 23 21:48:55 2017
     13// Update Count     : 485
    1414//
    1515
     
    157157TypeData * TypeData::clone() const {
    158158        TypeData * newtype = new TypeData( kind );
    159         newtype->typeQualifiers = typeQualifiers;
     159        newtype->qualifiers = qualifiers;
    160160        newtype->base = maybeClone( base );
    161161        newtype->forall = maybeClone( forall );
     
    226226
    227227void TypeData::print( ostream &os, int indent ) const {
    228         for ( int i = 0; i < DeclarationNode::NoTypeQualifier; i += 1 ) {
    229                 if ( typeQualifiers[i] ) os << DeclarationNode::typeQualifierNames[ i ] << ' ';
     228        for ( int i = 0; i < DeclarationNode::NoQualifier; i += 1 ) {
     229                if ( qualifiers[i] ) os << DeclarationNode::qualifierName[ i ] << ' ';
    230230        } // for
    231231
     
    250250                break;
    251251          case Basic:
    252                 if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " ";
    253                 if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " ";
     252                if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessName[ signedness ] << " ";
     253                if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthName[ length ] << " ";
    254254                assert( basictype != DeclarationNode::NoBasicType );
    255                 os << DeclarationNode::basicTypeNames[ basictype ] << " ";
    256                 if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeNames[ complextype ] << " ";
     255                os << DeclarationNode::basicTypeName[ basictype ] << " ";
     256                if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeName[ complextype ] << " ";
    257257                break;
    258258          case Array:
     
    301301                break;
    302302          case Aggregate:
    303                 os << DeclarationNode::aggregateNames[ aggregate.kind ] << ' ' << *aggregate.name << endl;
     303                os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << *aggregate.name << endl;
    304304                if ( aggregate.params ) {
    305305                        os << string( indent + 2, ' ' ) << "with type parameters " << endl;
     
    393393        buildList( firstNode, outputList );
    394394        for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
    395                 TypeDecl * td = static_cast<TypeDecl *>(*i);
     395                TypeDecl * td = static_cast<TypeDecl*>(*i);
    396396                if ( td->get_kind() == TypeDecl::Any ) {
    397397                        // add assertion parameters to `type' tyvars in reverse order
    398398                        // add dtor:  void ^?{}(T *)
    399399                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    400                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    401                         td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
     400                        dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     401                        td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
    402402
    403403                        // add copy ctor:  void ?{}(T *, T)
    404404                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    405                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    406                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    407                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     405                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     406                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     407                        td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
    408408
    409409                        // add default ctor:  void ?{}(T *)
    410410                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    411                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    412                         td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
     411                        ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     412                        td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
    413413
    414414                        // add assignment operator:  T * ?=?(T *, T)
    415415                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    416                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    417                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    418                         assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    419                         td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, assignType, nullptr ) );
     416                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     417                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     418                        assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     419                        td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
    420420                } // if
    421421        } // for
     
    494494Type::Qualifiers buildQualifiers( const TypeData * td ) {
    495495        Type::Qualifiers q;
    496         q.isConst = td->typeQualifiers[ DeclarationNode::Const ];
    497         q.isVolatile = td->typeQualifiers[ DeclarationNode::Volatile ];
    498         q.isRestrict = td->typeQualifiers[ DeclarationNode::Restrict ];
    499         q.isLvalue = td->typeQualifiers[ DeclarationNode::Lvalue ];
    500         q.isAtomic = td->typeQualifiers[ DeclarationNode::Atomic ];;
     496        q.isConst = td->qualifiers[ DeclarationNode::Const ];
     497        q.isVolatile = td->qualifiers[ DeclarationNode::Volatile ];
     498        q.isRestrict = td->qualifiers[ DeclarationNode::Restrict ];
     499        q.isLvalue = td->qualifiers[ DeclarationNode::Lvalue ];
     500        q.isAtomic = td->qualifiers[ DeclarationNode::Atomic ];;
    501501        return q;
    502502} // buildQualifiers
     
    516516          case DeclarationNode::Bool:
    517517                if ( td->signedness != DeclarationNode::NoSignedness ) {
    518                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     518                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    519519                } // if
    520520                if ( td->length != DeclarationNode::NoLength ) {
    521                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     521                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    522522                } // if
    523523
     
    532532
    533533                if ( td->length != DeclarationNode::NoLength ) {
    534                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     534                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    535535                } // if
    536536
     
    562562          FloatingPoint: ;
    563563                if ( td->signedness != DeclarationNode::NoSignedness ) {
    564                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessNames[ td->signedness ] + " in type: ", td );
     564                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );
    565565                } // if
    566566                if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) {
    567                         throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthNames[ td->length ] + " in type: ", td );
     567                        throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );
    568568                } // if
    569569                if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
     
    732732} // buildAggInst
    733733
    734 NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClasses scs ) {
     734NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClass sc ) {
    735735        assert( td->kind == TypeData::Symbolic );
    736736        NamedTypeDecl * ret;
    737737        assert( td->base );
    738738        if ( td->symbolic.isTypedef ) {
    739                 ret = new TypedefDecl( name, scs, typebuild( td->base ) );
     739                ret = new TypedefDecl( name, sc, typebuild( td->base ) );
    740740        } else {
    741                 ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Any );
     741                ret = new TypeDecl( name, sc, typebuild( td->base ), TypeDecl::Any );
    742742        } // if
    743743        buildList( td->symbolic.params, ret->get_parameters() );
     
    784784} // buildTypeof
    785785
    786 Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClasses scs, Expression * bitfieldWidth, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, ConstantExpr *asmName, Initializer * init, std::list< Attribute * > attributes ) {
     786Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, ConstantExpr *asmName, Initializer * init, std::list< Attribute * > attributes ) {
    787787        if ( td->kind == TypeData::Function ) {
    788788                if ( td->function.idList ) {                                    // KR function ?
     
    792792                FunctionDecl * decl;
    793793                Statement * stmt = maybeBuild<Statement>( td->function.body );
    794                 CompoundStmt * body = dynamic_cast< CompoundStmt * >( stmt );
    795                 decl = new FunctionDecl( name, scs, linkage, buildFunction( td ), body, attributes, funcSpec );
     794                CompoundStmt * body = dynamic_cast< CompoundStmt* >( stmt );
     795                decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn, attributes );
    796796                return decl->set_asmName( asmName );
    797797        } else if ( td->kind == TypeData::Aggregate ) {
     
    800800                return buildEnum( td, attributes );
    801801        } else if ( td->kind == TypeData::Symbolic ) {
    802                 return buildSymbolic( td, name, scs );
     802                return buildSymbolic( td, name, sc );
    803803        } else {
    804                 return (new ObjectDecl( name, scs, linkage, bitfieldWidth, typebuild( td ), init, attributes ))->set_asmName( asmName );
     804                return (new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, attributes, isInline, isNoreturn ))->set_asmName( asmName );
    805805        } // if
    806806        return nullptr;
     
    820820                        break;
    821821                  default:
    822                         ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType * >( buildDecl( td->base, "", DeclarationNode::StorageClasses(), nullptr, DeclarationNode::FuncSpecifiers(), LinkageSpec::Cforall, nullptr ) ) );
     822                        ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base,  "", DeclarationNode::NoStorageClass, nullptr, false, false, LinkageSpec::Cforall, nullptr ) ) );
    823823                } // switch
    824824        } else {
    825                 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
     825                ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
    826826        } // if
    827827        return ft;
     
    846846        for ( DeclarationNode * decl = function.oldDeclList; decl != nullptr; decl = dynamic_cast< DeclarationNode * >( decl->get_next() ) ) {
    847847                // scan ALL parameter names for each declaration name to check for duplicates
    848                 for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode * >( param->get_next() ) ) {
     848                for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode* >( param->get_next() ) ) {
    849849                        if ( *decl->name == *param->name ) {
    850850                                // type set => parameter name already transformed by a declaration names so there is a duplicate
     
    867867        //    rtb( a, b, c ) const char * b; {} => int rtn( int a, const char * b, int c ) {}
    868868
    869         for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode * >( param->get_next() ) ) {
     869        for ( DeclarationNode * param = function.idList; param != nullptr; param = dynamic_cast< DeclarationNode* >( param->get_next() ) ) {
    870870                if ( ! param->type ) {                                                  // generate type int for empty parameter type
    871871                        param->type = new TypeData( TypeData::Basic );
  • src/Parser/TypeData.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 08:03:53 2017
    13 // Update Count     : 173
     12// Last Modified On : Thu Feb 23 17:14:46 2017
     13// Update Count     : 158
    1414//
    1515
     
    7676        DeclarationNode::Length length = DeclarationNode::NoLength;
    7777        DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType;
    78         typedef std::bitset< DeclarationNode::NoTypeQualifier > TypeQualifiers;
    79         TypeQualifiers typeQualifiers;
     78        typedef std::bitset< DeclarationNode::NoQualifier > Qualifiers;
     79        Qualifiers qualifiers;
    8080        DeclarationNode * forall;
    8181
     
    107107ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
    108108ReferenceToType * buildAggInst( const TypeData * );
     109NamedTypeDecl * buildSymbolic( const TypeData *, const std::string &name, DeclarationNode::StorageClass sc );
    109110TypeDecl * buildVariable( const TypeData * );
    110111EnumDecl * buildEnum( const TypeData *, std::list< Attribute * > );
     
    112113TupleType * buildTuple( const TypeData * );
    113114TypeofType * buildTypeof( const TypeData * );
    114 Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClasses, Expression *, DeclarationNode::FuncSpecifiers funcSpec, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
     115Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, ConstantExpr *asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
    115116FunctionType * buildFunction( const TypeData * );
    116117void buildKRFunction( const TypeData::Function_t & function );
  • src/Parser/lex.ll

    rbe8bd88 r87c3bef  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Fri Mar  3 22:18:00 2017
    13  * Update Count     : 502
     12 * Last Modified On : Tue Nov 29 11:32:00 2016
     13 * Update Count     : 501
    1414 */
    1515
     
    235235long                    { KEYWORD_RETURN(LONG); }
    236236lvalue                  { KEYWORD_RETURN(LVALUE); }                             // CFA
    237 mutex                   { KEYWORD_RETURN(MUTEX); }                              // CFA
    238237_Noreturn               { KEYWORD_RETURN(NORETURN); }                   // C11
    239238__builtin_offsetof { KEYWORD_RETURN(OFFSETOF); }                // GCC
  • src/Parser/parser.yy

    rbe8bd88 r87c3bef  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Mar  5 15:48:24 2017
    13 // Update Count     : 2227
     12// Last Modified On : Tue Feb 28 09:58:10 2017
     13// Update Count     : 2208
    1414//
    1515
     
    9191// keywords
    9292%token TYPEDEF
    93 %token EXTERN STATIC AUTO REGISTER
    94 %token THREADLOCAL                                                                              // C11
    95 %token INLINE FORTRAN                                                                   // C99, extension ISO/IEC 9899:1999 Section J.5.9(1)
    96 %token NORETURN                                                                                 // C11
     93%token AUTO EXTERN REGISTER STATIC
     94%token INLINE                                                                                   // C99
     95%token FORTRAN                                                                                  // C99, extension ISO/IEC 9899:1999 Section J.5.9(1)
    9796%token CONST VOLATILE
    9897%token RESTRICT                                                                                 // C99
    99 %token ATOMIC                                                                                   // C11
    100 %token FORALL LVALUE MUTEX                                                              // CFA
     98%token FORALL LVALUE                                                                    // CFA
    10199%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T
    102100%token VALIST                                                                                   // GCC
     
    104102%token TYPEOF LABEL                                                                             // GCC
    105103%token ENUM STRUCT UNION
    106 %token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
     104%token OTYPE FTYPE DTYPE TTYPE TRAIT                                                    // CFA
    107105%token SIZEOF OFFSETOF
    108106%token ATTRIBUTE EXTENSION                                                              // GCC
     
    110108%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT        // CFA
    111109%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    112 %token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     110%token ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATICASSERT THREADLOCAL // C11
    113111
    114112// names and constants: lexer differentiates between identifier and typedef names
     
    14021400type_qualifier_name:
    14031401        CONST
    1404                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Const ); }
     1402                { $$ = DeclarationNode::newQualifier( DeclarationNode::Const ); }
    14051403        | RESTRICT
    1406                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Restrict ); }
     1404                { $$ = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
    14071405        | VOLATILE
    1408                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Volatile ); }
     1406                { $$ = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
    14091407        | LVALUE                                                                                        // CFA
    1410                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Lvalue ); }
    1411         | MUTEX
    1412                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Mutex ); }
     1408                { $$ = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
    14131409        | ATOMIC
    1414                 { $$ = DeclarationNode::newTypeQualifier( DeclarationNode::Atomic ); }
     1410                { $$ = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
    14151411        | FORALL '('
    14161412                {
     
    14521448        | REGISTER
    14531449                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
     1450        | INLINE                                                                                        // C99
     1451                //{ $$ = DeclarationNode::newStorageClass( DeclarationNode::Inline ); }
     1452                { $$ = new DeclarationNode; $$->isInline = true; }
     1453        | FORTRAN                                                                                       // C99
     1454                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
     1455        | NORETURN                                                                                      // C11
     1456                //{ $$ = DeclarationNode::newStorageClass( DeclarationNode::Noreturn ); }
     1457                { $$ = new DeclarationNode; $$->isNoreturn = true; }
    14541458        | THREADLOCAL                                                                           // C11
    14551459                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    1456                 // Put function specifiers here to simplify parsing rules, but separate them semantically.
    1457         | INLINE                                                                                        // C99
    1458                 { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Inline ); }
    1459         | FORTRAN                                                                                       // C99
    1460                 { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Fortran ); }
    1461         | NORETURN                                                                                      // C11
    1462                 { $$ = DeclarationNode::newFuncSpecifier( DeclarationNode::Noreturn ); }
    14631460        ;
    14641461
     
    20362033                { $$ = $3->addQualifiers( $1 ); }
    20372034        | type_declaring_list ',' type_declarator
    2038                 { $$ = $1->appendList( $3->copySpecifiers( $1 ) ); }
     2035                { $$ = $1->appendList( $3->copyStorageClasses( $1 ) ); }
    20392036        ;
    20402037
  • src/ResolvExpr/Unify.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 12:27:10 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:37:38 2017
    13 // Update Count     : 39
     12// Last Modified On : Wed Mar  2 17:37:05 2016
     13// Update Count     : 37
    1414//
    1515
     
    541541                        flatten( dcl->get_type(), back_inserter( types ) );
    542542                        for ( Type * t : types ) {
    543                                 dst.push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) );
     543                                dst.push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, t, nullptr ) );
    544544                        }
    545545                        delete dcl;
  • src/SymTab/Autogen.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:42:44 2017
    13 // Update Count     : 51
     12// Last Modified On : Thu Feb 16 15:02:50 2017
     13// Update Count     : 13
    1414//
    1515
     
    125125        FunctionType * genDefaultType( Type * paramType ) {
    126126                FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
    127                 ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr );
     127                ObjectDecl *dstParam = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), paramType->clone() ), nullptr );
    128128                ftype->get_parameters().push_back( dstParam );
    129129
     
    134134        FunctionType * genCopyType( Type * paramType ) {
    135135                FunctionType *ftype = genDefaultType( paramType );
    136                 ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
     136                ObjectDecl *srcParam = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    137137                ftype->get_parameters().push_back( srcParam );
    138138                return ftype;
     
    142142        FunctionType * genAssignType( Type * paramType ) {
    143143                FunctionType *ftype = genCopyType( paramType );
    144                 ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
     144                ObjectDecl *returnVal = new ObjectDecl( "_ret", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
    145145                ftype->get_returnVals().push_back( returnVal );
    146146                return ftype;
     
    161161                // Routines at global scope marked "static" to prevent multiple definitions in separate translation units
    162162                // because each unit generates copies of the default routines for each aggregate.
    163 //              DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static;
    164                 DeclarationNode::StorageClasses scs = functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::StaticClass );
     163                DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static;
    165164                LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen;
    166                 FunctionDecl * decl = new FunctionDecl( fname, scs, spec, ftype, new CompoundStmt( noLabels ),
    167                                                                                                 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) );
     165                FunctionDecl * decl = new FunctionDecl( fname, sc, spec, ftype, new CompoundStmt( noLabels ), true, false );
    168166                decl->fixUniqueId();
    169167                return decl;
     
    460458                                        continue;
    461459                                }
    462                                 memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) );
     460                                memCtorType->get_parameters().push_back( new ObjectDecl( member->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, member->get_type()->clone(), 0 ) );
    463461                                FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
    464462                                makeStructFieldCtorBody( aggregateDecl->get_members().begin(), aggregateDecl->get_members().end(), ctor, isDynamicLayout );
     
    540538                for ( Declaration * member : aggregateDecl->get_members() ) {
    541539                        if ( DeclarationWithType * field = dynamic_cast< DeclarationWithType * >( member ) ) {
    542                                 ObjectDecl * srcParam = new ObjectDecl( "src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 );
     540                                ObjectDecl * srcParam = new ObjectDecl( "src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 );
    543541
    544542                                FunctionType * memCtorType = ctorType->clone();
     
    605603                TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false );
    606604                typeInst->set_baseType( typeDecl );
    607                 ObjectDecl *src = new ObjectDecl( "_src", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr );
    608                 ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr );
     605                ObjectDecl *src = new ObjectDecl( "_src", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr );
     606                ObjectDecl *dst = new ObjectDecl( "_dst", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr );
    609607
    610608                std::list< Statement * > stmts;
     
    618616                } // if
    619617                FunctionType *type = new FunctionType( Type::Qualifiers(), false );
    620                 type->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, typeInst, 0 ) );
     618                type->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, typeInst, 0 ) );
    621619                type->get_parameters().push_back( dst );
    622620                type->get_parameters().push_back( src );
     
    717715                        if ( TypeInstType * ty = dynamic_cast< TypeInstType * >( t ) ) {
    718716                                if ( ! done.count( ty->get_baseType() ) ) {
    719                                         TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), DeclarationNode::StorageClasses(), nullptr, TypeDecl::Any );
     717                                        TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );
    720718                                        TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );
    721                                         newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
    722                                                                                                                                                    std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) );
    723                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    724                                                                                                                                                    std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) );
    725                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,
    726                                                                                                                                                    std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) );
    727                                         newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    728                                                                                                                                                    std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) );
     719                                        newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genAssignType( inst ), nullptr, true, false ) );
     720                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );
     721                                        newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genCopyType( inst ), nullptr, true, false ) );
     722                                        newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, genDefaultType( inst ), nullptr, true, false ) );
    729723                                        typeParams.push_back( newDecl );
    730724                                        done.insert( ty->get_baseType() );
  • src/SymTab/Autogen.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 21:53:34 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:33:01 2017
    13 // Update Count     : 4
     12// Last Modified On : Wed Feb  1 16:31:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    102102                }
    103103
    104                 ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
     104                ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) );
    105105
    106106                UntypedExpr *cond = new UntypedExpr( cmp );
  • src/SymTab/FixFunction.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 16:19:49 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:36:59 2017
    13 // Update Count     : 6
     12// Last Modified On : Wed Mar  2 17:31:10 2016
     13// Update Count     : 3
    1414//
    1515
     
    2121
    2222namespace SymTab {
    23         FixFunction::FixFunction() : isVoid( false ) {}
     23        FixFunction::FixFunction() : isVoid( false ) {
     24        }
    2425
    2526        DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) {
    26                 ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0, functionDecl->get_attributes() );
     27                ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0, functionDecl->get_attributes() );
    2728                functionDecl->get_attributes().clear();
    2829                delete functionDecl;
  • src/SymTab/Indexer.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 21:37:33 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:45:32 2017
    13 // Update Count     : 16
     12// Last Modified On : Thu Feb 16 14:59:19 2017
     13// Update Count     : 13
    1414//
    1515
     
    738738                                ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( added );
    739739                                ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( existing );
    740                                 if ( ! newobj->get_storageClasses()[ DeclarationNode::Extern ] && ! oldobj->get_storageClasses()[ DeclarationNode::Extern ] ) {
     740                                if ( newobj->get_storageClass() != DeclarationNode::Extern && oldobj->get_storageClass() != DeclarationNode::Extern ) {
    741741                                        throw SemanticError( "duplicate object definition for ", added );
    742742                                } // if
  • src/SymTab/Validate.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:51:36 2017
    13 // Update Count     : 349
     12// Last Modified On : Thu Feb 23 21:33:55 2017
     13// Update Count     : 318
    1414//
    1515
     
    9797        class ReturnTypeFixer final : public Visitor {
    9898          public:
     99
    99100                typedef Visitor Parent;
    100101                using Parent::visit;
     
    103104
    104105                virtual void visit( FunctionDecl * functionDecl );
     106
    105107                virtual void visit( FunctionType * ftype );
    106108        };
     
    159161          private:
    160162                virtual void visit( FunctionDecl * functionDecl );
     163
    161164                virtual void visit( ReturnStmt * returnStmt );
    162165
     
    208211
    209212        class CompoundLiteral final : public GenPoly::DeclMutator {
    210                 DeclarationNode::StorageClasses storageClasses;
     213                DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass;
    211214
    212215                using GenPoly::DeclMutator::mutate;
     
    657660                // Note, qualifiers on the typedef are superfluous for the forward declaration.
    658661                if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( tyDecl->get_base() ) ) {
    659                         return new StructDecl( aggDecl->get_name() );
     662                        return aggDecl->get_baseStruct() ? Mutator::mutate( aggDecl->get_baseStruct() ) : new StructDecl( aggDecl->get_name() );
    660663                } else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( tyDecl->get_base() ) ) {
    661                         return new UnionDecl( aggDecl->get_name() );
     664                        return aggDecl->get_baseUnion() ? Mutator::mutate( aggDecl->get_baseUnion() ) : new UnionDecl( aggDecl->get_name() );
    662665                } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( tyDecl->get_base() ) ) {
    663666                        return new EnumDecl( enumDecl->get_name() );
     
    688691                DeclarationWithType *ret = Mutator::mutate( objDecl );
    689692                typedefNames.endScope();
    690 
    691                 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { // function type?
     693                // is the type a function?
     694                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) {
    692695                        // replace the current object declaration with a function declaration
    693                         FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClasses(), ret->get_linkage(), funtype, 0, objDecl->get_attributes(), ret->get_funcSpec() );
     696                        FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClass(), ret->get_linkage(), funtype, 0, ret->get_isInline(), ret->get_isNoreturn(), objDecl->get_attributes() );
    694697                        objDecl->get_attributes().clear();
    695698                        objDecl->set_type( nullptr );
    696699                        delete objDecl;
    697700                        return newDecl;
     701                } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) {
     702                        throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl );
    698703                } // if
    699704                return ret;
     
    754759                                type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    755760                        } // if
    756                         TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::StorageClasses(), type ) );
     761                        TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type ) );
    757762                        typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel );
    758763                } // if
     
    808813
    809814        DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
    810                 storageClasses = objectDecl->get_storageClasses();
     815                storageclass = objectDecl->get_storageClass();
    811816                DeclarationWithType * temp = Mutator::mutate( objectDecl );
     817                storageclass = DeclarationNode::NoStorageClass;
    812818                return temp;
    813819        }
     
    818824                static UniqueName indexName( "_compLit" );
    819825
    820                 ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_type(), compLitExpr->get_initializer() );
     826                ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageclass, LinkageSpec::C, 0, compLitExpr->get_type(), compLitExpr->get_initializer() );
    821827                compLitExpr->set_type( 0 );
    822828                compLitExpr->set_initializer( 0 );
     
    857863                        TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    858864                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    859                         ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
     865                        ObjectDecl * newRet = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
    860866                        deleteAll( retVals );
    861867                        retVals.clear();
  • src/SynTree/AggregateDecl.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Sun May 17 23:56:39 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:31:47 2017
    13 // Update Count     : 19
     12// Last Modified On : Mon Feb  6 15:31:23 2017
     13// Update Count     : 17
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, DeclarationNode::NoStorageClass, LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Declaration.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:31:11 2017
    13 // Update Count     : 23
     12// Last Modified On : Thu Feb  9 14:28:05 2017
     13// Update Count     : 16
    1414//
    1515
     
    2727static IdMapType idMap;
    2828
    29 Declaration::Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage )
    30                 : name( name ), storageClasses( scs ), linkage( linkage ), uniqueId( 0 ) {
     29Declaration::Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage )
     30                : name( name ), storageClass( sc ), linkage( linkage ), isInline( false ), isNoreturn( false ), uniqueId( 0 ) {
    3131}
    3232
    3333Declaration::Declaration( const Declaration &other )
    34         : name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage ), uniqueId( other.uniqueId ) {
     34        : name( other.name ), storageClass( other.storageClass ), linkage( other.linkage ), isInline( other.isInline ), isNoreturn( other.isNoreturn ), uniqueId( other.uniqueId ) {
    3535}
    3636
     
    6666
    6767
    68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
     68AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::NoStorageClass, LinkageSpec::C ), stmt( stmt ) {
    6969}
    7070
  • src/SynTree/Declaration.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:40:42 2017
    13 // Update Count     : 113
     12// Last Modified On : Thu Feb 16 14:53:35 2017
     13// Update Count     : 57
    1414//
    1515
     
    2828class Declaration : public BaseSyntaxNode {
    2929  public:
    30         Declaration( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage );
     30        Declaration( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage );
    3131        Declaration( const Declaration &other );
    3232        virtual ~Declaration();
     
    3434        const std::string &get_name() const { return name; }
    3535        void set_name( std::string newValue ) { name = newValue; }
    36 
    37         DeclarationNode::StorageClasses get_storageClasses() const { return storageClasses; }
    38 
     36        DeclarationNode::StorageClass get_storageClass() const { return storageClass; }
     37        void set_storageClass( DeclarationNode::StorageClass newValue ) { storageClass = newValue; }
    3938        LinkageSpec::Spec get_linkage() const { return linkage; }
    4039        void set_linkage( LinkageSpec::Spec newValue ) { linkage = newValue; }
    41 
     40        bool get_isInline() const { return isInline; }
     41        void set_isInline( bool newValue ) { isInline = newValue; }
     42        bool get_isNoreturn() const { return isNoreturn; }
     43        void set_isNoreturn( bool newValue ) { isNoreturn = newValue; }
    4244        UniqueId get_uniqueId() const { return uniqueId; }
    43 
    4445        bool get_extension() const { return extension; }
    4546        Declaration *set_extension( bool exten ) { extension = exten; return this; }
     
    5657  private:
    5758        std::string name;
    58         DeclarationNode::StorageClasses storageClasses;
     59        DeclarationNode::StorageClass storageClass;
    5960        LinkageSpec::Spec linkage;
     61        bool isInline, isNoreturn;
    6062        UniqueId uniqueId;
    6163        bool extension = false;
     
    6466class DeclarationWithType : public Declaration {
    6567  public:
    66         DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs );
     68        DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes );
    6769        DeclarationWithType( const DeclarationWithType &other );
    6870        virtual ~DeclarationWithType();
     
    8183        std::list< Attribute * >& get_attributes() { return attributes; }
    8284        const std::list< Attribute * >& get_attributes() const { return attributes; }
    83 
    84         DeclarationNode::FuncSpecifiers get_funcSpec() const { return fs; }
    85         //void set_functionSpecifiers( DeclarationNode::FuncSpecifiers newValue ) { fs = newValue; }
    8685
    8786        virtual DeclarationWithType *clone() const = 0;
     
    9897        ConstantExpr *asmName;
    9998        std::list< Attribute * > attributes;
    100         DeclarationNode::FuncSpecifiers fs;
    10199};
    102100
     
    104102        typedef DeclarationWithType Parent;
    105103  public:
    106         ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init,
    107                                 const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
     104        ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false );
    108105        ObjectDecl( const ObjectDecl &other );
    109106        virtual ~ObjectDecl();
     
    132129        typedef DeclarationWithType Parent;
    133130  public:
    134         FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
    135                                   const std::list< Attribute * > attributes = std::list< Attribute * >(), DeclarationNode::FuncSpecifiers fs = DeclarationNode::FuncSpecifiers() );
     131        FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, const std::list< Attribute * > attributes = std::list< Attribute * >() );
    136132        FunctionDecl( const FunctionDecl &other );
    137133        virtual ~FunctionDecl();
     
    158154        typedef Declaration Parent;
    159155  public:
    160         NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type );
     156        NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type );
    161157        NamedTypeDecl( const NamedTypeDecl &other );
    162158        virtual ~NamedTypeDecl();
     
    193189        };
    194190
    195         TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind );
     191        TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind );
    196192        TypeDecl( const TypeDecl &other );
    197193
     
    214210        typedef NamedTypeDecl Parent;
    215211  public:
    216         TypedefDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}
     212        TypedefDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
    217213        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    218214
  • src/SynTree/DeclarationWithType.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:32:14 2017
    13 // Update Count     : 23
     12// Last Modified On : Tue Dec 13 14:49:43 2016
     13// Update Count     : 7
    1414//
    1515
     
    1919#include "Common/utility.h"
    2020
    21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, DeclarationNode::FuncSpecifiers fs )
    22         : Declaration( name, scs, linkage ), asmName( nullptr ), attributes( attributes ), fs( fs ) {
     21DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes )
     22        : Declaration( name, sc, linkage ), asmName( nullptr ), attributes( attributes ) {
    2323}
    2424
    2525DeclarationWithType::DeclarationWithType( const DeclarationWithType &other )
    26                 : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ), fs( other.fs ) {
     26                : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) {
    2727        cloneAll( other.attributes, attributes );
    2828        asmName = maybeClone( other.asmName );
  • src/SynTree/FunctionDecl.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:54:58 2017
    13 // Update Count     : 68
     12// Last Modified On : Thu Feb 16 15:01:52 2017
     13// Update Count     : 23
    1414//
    1515
     
    2626extern bool translation_unit_nomain;
    2727
    28 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
    29         : Parent( name, scs, linkage, attributes, fs ), type( type ), statements( statements ) {
    30         // hack forcing the function "main" to have Cforall linkage to replace main even if it is inside an extern
     28FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
     29                : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) {
     30        set_isInline( isInline );
     31        set_isNoreturn( isNoreturn );
     32        // this is a brazen hack to force the function "main" to have Cforall linkage
     33        // because we want to replace the main even if it is inside an extern
    3134        if ( name == "main" ) {
    3235                set_linkage( CodeGen::FixMain::mainLinkage() );
     
    3538
    3639FunctionDecl::FunctionDecl( const FunctionDecl &other )
    37                 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
     40        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    3841}
    3942
     
    6265                os << LinkageSpec::linkageName( get_linkage() ) << " ";
    6366        } // if
     67        if ( get_isInline() ) {
     68                os << "inline ";
     69        } // if
     70        if ( get_isNoreturn() ) {
     71                os << "_Noreturn ";
     72        } // if
    6473
    6574        printAll( get_attributes(), os, indent );
    6675
    67         DeclarationNode::print_StorageClass( os, get_storageClasses() );
    68         DeclarationNode::print_FuncSpec( os, get_funcSpec() );
    69 
     76        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     77                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     78        } // if
    7079        if ( get_type() ) {
    7180                get_type()->print( os, indent );
     
    8897                os << get_name() << ": ";
    8998        } // if
     99        if ( get_isInline() ) {
     100                os << "inline ";
     101        } // if
     102        if ( get_isNoreturn() ) {
     103                os << "_Noreturn ";
     104        } // if
    90105
    91106        // xxx - should printShort print attributes?
    92107
    93         DeclarationNode::print_StorageClass( os, get_storageClasses() );
    94         DeclarationNode::print_FuncSpec( os, get_funcSpec() );
    95 
     108        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     109                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     110        } // if
    96111        if ( get_type() ) {
    97112                get_type()->print( os, indent );
  • src/SynTree/NamedTypeDecl.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:39:41 2017
    13 // Update Count     : 10
     12// Last Modified On : Sat Jun 13 08:13:55 2015
     13// Update Count     : 3
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *base )
    21         : Parent( name, scs, LinkageSpec::Cforall ), base( base ) {}
     20NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base )
     21        : Parent( name, sc, LinkageSpec::Cforall ), base( base ) {}
    2222
    2323NamedTypeDecl::NamedTypeDecl( const NamedTypeDecl &other )
     
    3939                os << get_name() << ": ";
    4040        } // if
    41         DeclarationNode::print_StorageClass( os, get_storageClasses() );
     41        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     42                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     43        } // if
    4244        os << typeString();
    4345        if ( base ) {
     
    6163                os << get_name() << ": ";
    6264        } // if
    63         DeclarationNode::print_StorageClass( os, get_storageClasses() );
     65        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     66                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     67        } // if
    6468        os << typeString();
    6569        if ( base ) {
  • src/SynTree/ObjectDecl.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:55:24 2017
    13 // Update Count     : 54
     12// Last Modified On : Sat Oct  1 23:05:56 2016
     13// Update Count     : 32
    1414//
    1515
     
    2222#include "Statement.h"
    2323
    24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, DeclarationNode::FuncSpecifiers fs )
    25         : Parent( name, scs, linkage, attributes, fs ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
     24ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn )
     25        : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
     26        set_isInline( isInline );
     27        set_isNoreturn( isNoreturn );
    2628}
    2729
     
    4749        printAll( get_attributes(), os, indent );
    4850
    49         DeclarationNode::print_StorageClass( os, get_storageClasses() );
     51        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     52                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     53        } // if
    5054
    5155        if ( get_type() ) {
     
    8185        // xxx - should printShort print attributes?
    8286
    83         DeclarationNode::print_StorageClass( os, get_storageClasses() );
     87        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     88                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
     89        } // if
    8490
    8591        if ( get_type() ) {
  • src/SynTree/Type.h

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  1 09:11:45 2017
    13 // Update Count     : 41
     12// Last Modified On : Thu Feb 23 16:38:53 2017
     13// Update Count     : 34
    1414//
    1515
     
    2121#include "SynTree.h"
    2222#include "Visitor.h"
     23#include "Common/utility.h"
    2324
    2425class Type : public BaseSyntaxNode {
     
    212213        bool get_isVarArgs() const { return isVarArgs; }
    213214        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
     215
    214216        bool isTtype() const;
    215217
  • src/SynTree/TypeDecl.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:39:09 2017
    13 // Update Count     : 4
     12// Last Modified On : Sat Jun 13 08:14:35 2015
     13// Update Count     : 2
    1414//
    1515
     
    1818#include "Common/utility.h"
    1919
    20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClasses scs, Type *type, Kind kind ) : Parent( name, scs, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
     20TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any || kind == Ttype ) {
    2121}
    2222
  • src/Tuples/TupleAssignment.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 23:40:14 2017
    13 // Update Count     : 5
     12// Last Modified On : Wed Feb  1 16:40:16 2017
     13// Update Count     : 3
    1414//
    1515
     
    240240        ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) {
    241241                assert( expr->has_result() && ! expr->get_result()->isVoid() );
    242                 ObjectDecl * ret = new ObjectDecl( namer.newName(), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
     242                ObjectDecl * ret = new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    243243                ConstructorInit * ctorInit = InitTweak::genCtorInit( ret );
    244244                ret->set_init( ctorInit );
  • src/Tuples/TupleExpansion.cc

    rbe8bd88 r87c3bef  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar  7 07:43:56 2017
    13 // Update Count     : 12
     12// Last Modified On : Wed Feb  1 16:40:40 2017
     13// Update Count     : 3
    1414//
    1515
     
    187187                        }
    188188                        BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    189                         ObjectDecl * finished = new ObjectDecl( toString( "_unq_expr_finished_", id ), DeclarationNode::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators ) );
     189                        ObjectDecl * finished = new ObjectDecl( toString( "_unq_expr_finished_", id ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators ) );
    190190                        addDeclaration( finished );
    191191                        // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N))
     
    221221                        decl->set_body( true );
    222222                        for ( size_t i = 0; i < tupleSize; ++i ) {
    223                                 TypeDecl * tyParam = new TypeDecl( toString( "tuple_param_", i ), DeclarationNode::StorageClasses(), nullptr, TypeDecl::Any );
    224                                 decl->get_members().push_back( new ObjectDecl( toString("field_", i ), DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) );
     223                                TypeDecl * tyParam = new TypeDecl( toString("tuple_param_", i), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );
     224                                decl->get_members().push_back( new ObjectDecl( toString("field_", i), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) );
    225225                                decl->get_parameters().push_back( tyParam );
    226226                        }
    227227                        if ( tupleSize == 0 ) {
    228228                                // empty structs are not standard C. Add a dummy field to empty tuples to silence warnings when a compound literal Tuple0 is created.
    229                                 decl->get_members().push_back( new ObjectDecl( "dummy", DeclarationNode::StorageClasses(), LinkageSpec::C, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
     229                                decl->get_members().push_back( new ObjectDecl( "dummy", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
    230230                        }
    231231                        typeMap[tupleSize] = decl;
  • src/benchmark/Makefile.am

    rbe8bd88 r87c3bef  
    1818CFLAGS =
    1919AM_CFLAGS = -g -Wall -Wno-unused-function -O2
    20 CC = @CFA_BINDIR@/@CFA_NAME@
     20CC = @CFA_BINDIR@/cfa
    2121
    2222noinst_PROGRAMS = bench ctxswitch-coroutine ctxswitch-thread
  • src/benchmark/Makefile.in

    rbe8bd88 r87c3bef  
    9494AWK = @AWK@
    9595BACKEND_CC = @BACKEND_CC@
    96 CC = @CFA_BINDIR@/@CFA_NAME@
     96CC = @CFA_BINDIR@/cfa
    9797CCAS = @CCAS@
    9898CCASDEPMODE = @CCASDEPMODE@
     
    104104CFA_INCDIR = @CFA_INCDIR@
    105105CFA_LIBDIR = @CFA_LIBDIR@
    106 CFA_NAME = @CFA_NAME@
    107106CFA_PREFIX = @CFA_PREFIX@
    108107
  • src/driver/Makefile.am

    rbe8bd88 r87c3bef  
    2828endif
    2929
    30 noinst_PROGRAMS = cfa
     30bin_PROGRAMS = cfa
    3131cfa_SOURCES = cfa.cc
    3232
    33 install-exec-hook:
    34         @echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) cfa '$(CFA_BINDIR)/$(CFA_NAME)'"; \
    35         $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) cfa $(CFA_BINDIR)/$(CFA_NAME) || exit $$?
    36 
    37 uninstall-hook:
    38         @echo " ( cd '$(CFA_BINDIR)' && rm -f $(CFA_NAME) )"; \
    39         cd "$(CFA_BINDIR)" && rm -f $(CFA_NAME)
    40 
    4133# put into lib for now
    42 cc1libdir = ${CFA_LIBDIR}
     34cc1libdir = ${libdir}
    4335cc1lib_PROGRAMS = cc1
    4436cc1_SOURCES = cc1.cc
    4537
    46 MAINTAINERCLEANFILES = $(CFA_BINDIR)/$(CFA_NAME) @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
     38MAINTAINERCLEANFILES = @CFA_PREFIX@/bin/${bin_PROGRAMS} @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
  • src/driver/Makefile.in

    rbe8bd88 r87c3bef  
    4141@BUILD_DEBUG_TRUE@am__append_2 = -DHAVE_LIBCFA_DEBUG
    4242@BUILD_RELEASE_TRUE@am__append_3 = -DHAVE_LIBCFA_RELEASE
    43 noinst_PROGRAMS = cfa$(EXEEXT)
     43bin_PROGRAMS = cfa$(EXEEXT)
    4444cc1lib_PROGRAMS = cc1$(EXEEXT)
    4545subdir = src/driver
     
    5353CONFIG_CLEAN_FILES =
    5454CONFIG_CLEAN_VPATH_FILES =
    55 am__installdirs = "$(DESTDIR)$(cc1libdir)"
    56 PROGRAMS = $(cc1lib_PROGRAMS) $(noinst_PROGRAMS)
     55am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cc1libdir)"
     56PROGRAMS = $(bin_PROGRAMS) $(cc1lib_PROGRAMS)
    5757am_cc1_OBJECTS = cc1.$(OBJEXT)
    5858cc1_OBJECTS = $(am_cc1_OBJECTS)
     
    106106CFA_INCDIR = @CFA_INCDIR@
    107107CFA_LIBDIR = @CFA_LIBDIR@
    108 CFA_NAME = @CFA_NAME@
    109108CFA_PREFIX = @CFA_PREFIX@
    110109CFLAGS = @CFLAGS@
     
    213212
    214213# put into lib for now
    215 cc1libdir = ${CFA_LIBDIR}
     214cc1libdir = ${libdir}
    216215cc1_SOURCES = cc1.cc
    217 MAINTAINERCLEANFILES = $(CFA_BINDIR)/$(CFA_NAME) @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
     216MAINTAINERCLEANFILES = @CFA_PREFIX@/bin/${bin_PROGRAMS} @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
    218217all: all-am
    219218
     
    250249        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    251250$(am__aclocal_m4_deps):
     251install-binPROGRAMS: $(bin_PROGRAMS)
     252        @$(NORMAL_INSTALL)
     253        test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
     254        @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
     255        for p in $$list; do echo "$$p $$p"; done | \
     256        sed 's/$(EXEEXT)$$//' | \
     257        while read p p1; do if test -f $$p; \
     258          then echo "$$p"; echo "$$p"; else :; fi; \
     259        done | \
     260        sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
     261            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
     262        sed 'N;N;N;s,\n, ,g' | \
     263        $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
     264          { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
     265            if ($$2 == $$4) files[d] = files[d] " " $$1; \
     266            else { print "f", $$3 "/" $$4, $$1; } } \
     267          END { for (d in files) print "f", d, files[d] }' | \
     268        while read type dir files; do \
     269            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
     270            test -z "$$files" || { \
     271              echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
     272              $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
     273            } \
     274        ; done
     275
     276uninstall-binPROGRAMS:
     277        @$(NORMAL_UNINSTALL)
     278        @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
     279        files=`for p in $$list; do echo "$$p"; done | \
     280          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
     281              -e 's/$$/$(EXEEXT)/' `; \
     282        test -n "$$list" || exit 0; \
     283        echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
     284        cd "$(DESTDIR)$(bindir)" && rm -f $$files
     285
     286clean-binPROGRAMS:
     287        -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
    252288install-cc1libPROGRAMS: $(cc1lib_PROGRAMS)
    253289        @$(NORMAL_INSTALL)
     
    287323clean-cc1libPROGRAMS:
    288324        -test -z "$(cc1lib_PROGRAMS)" || rm -f $(cc1lib_PROGRAMS)
    289 
    290 clean-noinstPROGRAMS:
    291         -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
    292325cc1$(EXEEXT): $(cc1_OBJECTS) $(cc1_DEPENDENCIES) $(EXTRA_cc1_DEPENDENCIES)
    293326        @rm -f cc1$(EXEEXT)
     
    406439all-am: Makefile $(PROGRAMS)
    407440installdirs:
    408         for dir in "$(DESTDIR)$(cc1libdir)"; do \
     441        for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cc1libdir)"; do \
    409442          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
    410443        done
     
    442475clean: clean-am
    443476
    444 clean-am: clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS \
     477clean-am: clean-binPROGRAMS clean-cc1libPROGRAMS clean-generic \
    445478        mostlyclean-am
    446479
     
    469502install-dvi-am:
    470503
    471 install-exec-am:
    472         @$(NORMAL_INSTALL)
    473         $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
     504install-exec-am: install-binPROGRAMS
     505
    474506install-html: install-html-am
    475507
     
    509541ps-am:
    510542
    511 uninstall-am: uninstall-cc1libPROGRAMS
    512         @$(NORMAL_INSTALL)
    513         $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
    514 .MAKE: install-am install-exec-am install-strip uninstall-am
    515 
    516 .PHONY: CTAGS GTAGS all all-am check check-am clean \
    517         clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS ctags \
    518         distclean distclean-compile distclean-generic distclean-tags \
    519         distdir dvi dvi-am html html-am info info-am install \
    520         install-am install-cc1libPROGRAMS install-data install-data-am \
    521         install-dvi install-dvi-am install-exec install-exec-am \
    522         install-exec-hook install-html install-html-am install-info \
     543uninstall-am: uninstall-binPROGRAMS uninstall-cc1libPROGRAMS
     544
     545.MAKE: install-am install-strip
     546
     547.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
     548        clean-cc1libPROGRAMS clean-generic ctags distclean \
     549        distclean-compile distclean-generic distclean-tags distdir dvi \
     550        dvi-am html html-am info info-am install install-am \
     551        install-binPROGRAMS install-cc1libPROGRAMS install-data \
     552        install-data-am install-dvi install-dvi-am install-exec \
     553        install-exec-am install-html install-html-am install-info \
    523554        install-info-am install-man install-pdf install-pdf-am \
    524555        install-ps install-ps-am install-strip installcheck \
     
    526557        maintainer-clean-generic mostlyclean mostlyclean-compile \
    527558        mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
    528         uninstall-am uninstall-cc1libPROGRAMS uninstall-hook
    529 
    530 
    531 install-exec-hook:
    532         @echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) cfa '$(CFA_BINDIR)/$(CFA_NAME)'"; \
    533         $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) cfa $(CFA_BINDIR)/$(CFA_NAME) || exit $$?
    534 
    535 uninstall-hook:
    536         @echo " ( cd '$(CFA_BINDIR)' && rm -f $(CFA_NAME) )"; \
    537         cd "$(CFA_BINDIR)" && rm -f $(CFA_NAME)
     559        uninstall-am uninstall-binPROGRAMS uninstall-cc1libPROGRAMS
     560
    538561
    539562# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/examples/Makefile.am

    rbe8bd88 r87c3bef  
    1818CFLAGS =
    1919AM_CFLAGS = -g -Wall -Wno-unused-function -O2
    20 CC = @CFA_BINDIR@/@CFA_NAME@
     20CC = @CFA_BINDIR@/cfa
    2121
    2222noinst_PROGRAMS = fstream_test vector_test avl_test Bench # build but do not install
  • src/examples/Makefile.in

    rbe8bd88 r87c3bef  
    105105AWK = @AWK@
    106106BACKEND_CC = @BACKEND_CC@
    107 CC = @CFA_BINDIR@/@CFA_NAME@
     107CC = @CFA_BINDIR@/cfa
    108108CCAS = @CCAS@
    109109CCASDEPMODE = @CCASDEPMODE@
     
    115115CFA_INCDIR = @CFA_INCDIR@
    116116CFA_LIBDIR = @CFA_LIBDIR@
    117 CFA_NAME = @CFA_NAME@
    118117CFA_PREFIX = @CFA_PREFIX@
    119118
  • src/libcfa/Makefile.am

    rbe8bd88 r87c3bef  
    1818AUTOMAKE_OPTIONS = subdir-objects
    1919
    20 libdir = ${CFA_LIBDIR}
    2120lib_LIBRARIES =
    2221
     
    6867${libobjs} : ${abs_top_srcdir}/src/driver/cfa-cpp ${cfalib_DATA} # add dependency to cfa-cpp so all libraries are rebuilt with new translator
    6968
     69
    7070libcfa_a_SOURCES = ${libsrc}
    7171libcfa_a_CFLAGS = -nodebug -O2
     
    7575stdhdr = ${shell echo stdhdr/*}
    7676
    77 cfa_includedir = $(CFA_INCDIR)
     77cfa_includedir = $(includedir)/cfa
    7878nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h
    7979
     
    8181
    8282maintainer-clean-local:
    83         -rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
     83        -rm -rf ${includedir}/*
  • src/libcfa/Makefile.in

    rbe8bd88 r87c3bef  
    201201CFA_INCDIR = @CFA_INCDIR@
    202202CFA_LIBDIR = @CFA_LIBDIR@
    203 CFA_NAME = @CFA_NAME@
    204203CFA_PREFIX = @CFA_PREFIX@
    205204CFLAGS = -quiet -no-include-stdhdr -XCFA -t -B${abs_top_srcdir}/src/driver ${EXTRA_FLAGS}
     
    282281infodir = @infodir@
    283282install_sh = @install_sh@
    284 libdir = ${CFA_LIBDIR}
     283libdir = @libdir@
    285284libexecdir = @libexecdir@
    286285localedir = @localedir@
     
    316315libcfa_d_a_CFLAGS = -debug -O0
    317316stdhdr = ${shell echo stdhdr/*}
    318 cfa_includedir = $(CFA_INCDIR)
     317cfa_includedir = $(includedir)/cfa
    319318nobase_cfa_include_HEADERS = ${headers} ${stdhdr} concurrency/invoke.h
    320319CLEANFILES = libcfa-prelude.c
     
    11611160
    11621161maintainer-clean-local:
    1163         -rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
     1162        -rm -rf ${includedir}/*
    11641163
    11651164# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/libcfa/iostream

    rbe8bd88 r87c3bef  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 20:51:35 2017
    13 // Update Count     : 98
     12// Last Modified On : Fri Feb 24 21:09:09 2017
     13// Update Count     : 94
    1414//
    1515
     
    6868forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, const void * );
    6969
    70 // tuples
    71 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } ) ostype * ?|?( ostype * os, T arg, Params rest );
    72 
     70forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) );
    7371// manipulators
    74 forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, ostype * (*)( ostype * ) );
    7572forall( dtype ostype | ostream( ostype ) ) ostype * endl( ostype * );
    7673forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
  • src/libcfa/iostream.c

    rbe8bd88 r87c3bef  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 20:52:02 2017
    13 // Update Count     : 313
     12// Last Modified On : Fri Feb 24 21:09:59 2017
     13// Update Count     : 307
    1414//
    1515
     
    155155        enum { Open = 1, Close, OpenClose };
    156156        static const unsigned char mask[256] = {
    157                 // opening delimiters, no space after
     157                // opening delimiters
    158158                ['('] : Open, ['['] : Open, ['{'] : Open,
    159                 ['$'] : Open, ['='] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
     159                ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
    160160                [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
    161                 // closing delimiters, no space before
     161                // closing delimiters
    162162                [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
    163163                [')'] : Close, [']'] : Close, ['}'] : Close,
    164164                ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
    165                 // opening-closing delimiters, no space before or after
     165                // opening-closing delimiters
    166166                ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
    167167                [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
     
    198198
    199199
    200 // tuples
    201 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
    202 ostype * ?|?( ostype * os, T arg, Params rest ) {
    203         os | arg | ", ";
    204         os | rest;
    205 } // ?|?
    206 
    207 
    208 // manipulators
    209200forall( dtype ostype | ostream( ostype ) )
    210201ostype * ?|?( ostype * os, ostype * (* manip)( ostype * ) ) {
  • src/libcfa/stdlib

    rbe8bd88 r87c3bef  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Mar  4 22:03:54 2017
    13 // Update Count     : 102
     12// Last Modified On : Fri Feb 24 21:07:16 2017
     13// Update Count     : 101
    1414//
    1515
  • src/libcfa/stdlib.c

    rbe8bd88 r87c3bef  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Mar  4 22:02:22 2017
    13 // Update Count     : 172
     12// Last Modified On : Fri Feb 24 21:08:11 2017
     13// Update Count     : 171
    1414//
    1515
  • src/prelude/Makefile.am

    rbe8bd88 r87c3bef  
    1919
    2020# put into lib for now
    21 cfalibdir = ${CFA_LIBDIR}
     21cfalibdir = ${libdir}
    2222cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    2323noinst_DATA = ../libcfa/libcfa-prelude.c
  • src/prelude/Makefile.in

    rbe8bd88 r87c3bef  
    105105CFA_INCDIR = @CFA_INCDIR@
    106106CFA_LIBDIR = @CFA_LIBDIR@
    107 CFA_NAME = @CFA_NAME@
    108107CFA_PREFIX = @CFA_PREFIX@
    109108CFLAGS = @CFLAGS@
     
    210209
    211210# put into lib for now
    212 cfalibdir = ${CFA_LIBDIR}
     211cfalibdir = ${libdir}
    213212cfalib_DATA = builtins.cf extras.cf prelude.cf bootloader.c
    214213noinst_DATA = ../libcfa/libcfa-prelude.c
  • src/tests/.expect/tupleAssign.txt

    rbe8bd88 r87c3bef  
    1 u=5 v=6 x=10 y=11 z=[100, 200]
    21u=5 v=6 x=10 y=11 z=[100, 200]
    32u=11 v=10 x=11 y=10 z=[11, 10]
    4 u=11 v=10 x=11 y=10 z=[11, 10]
    5 u=10 v=11 z=[10, 11]
    63u=10 v=11 z=[10, 11]
    74u=123 v=456 z=[111, 222]
    8 u=123 v=456 z=[111, 222]
    9 d=94.12 i=94 c=^ t=[94, 94.12, 94]
    10 d=94.12 i=94 c=^ t=[94, 94.12, 94]
    11 d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
    12 d=-94.12 i=-94 c=¢ t=[-94, -94.12, -94]
     5d=-2153.12 i=-2153 c=-105 t=[-2153, -2153.12, -2153]
     6d=-2153.12 i=-2153 c=-105 t=[-2153, -2153.12, -2153]
  • src/tests/Makefile.am

    rbe8bd88 r87c3bef  
    3030EXTRA_FLAGS =
    3131CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
    32 CC = @CFA_BINDIR@/@CFA_NAME@
     32CC = @CFA_BINDIR@/cfa
    3333
    3434.PHONY : list
  • src/tests/Makefile.in

    rbe8bd88 r87c3bef  
    113113AWK = @AWK@
    114114BACKEND_CC = @BACKEND_CC@
    115 CC = @CFA_BINDIR@/@CFA_NAME@
     115CC = @CFA_BINDIR@/cfa
    116116CCAS = @CCAS@
    117117CCASDEPMODE = @CCASDEPMODE@
     
    123123CFA_INCDIR = @CFA_INCDIR@
    124124CFA_LIBDIR = @CFA_LIBDIR@
    125 CFA_NAME = @CFA_NAME@
    126125CFA_PREFIX = @CFA_PREFIX@
    127126CFLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}
  • src/tests/tupleAssign.c

    rbe8bd88 r87c3bef  
    99// Author           : Rob Schluntz
    1010// Created On       : Tue Nov 15 17:24:32 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  6 21:23:58 2017
    13 // Update Count     : 34
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Nov 15 17:27:28 2016
     13// Update Count     : 3
    1414//
    15 
    16 #include <fstream>
    1715
    1816int main() {
     
    2321
    2422                // swap x, y and store the new [x, y] in [u, v] and in z;
    25                 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
    26                 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
     23                printf("u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z);
    2724                z = [u, v] = [x, y] = [y, x];
    28                 printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
    29                 sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]" | endl;
     25                printf("u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z);
    3026
    3127                // shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
    3228                [v, z, u] = [z, u, v];
    33                 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
    34                 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
     29                printf("u=%d v=%d z=[%d, %d]\n", u, v, z);
    3530
    3631                // multiple assignment with tuple expression on right
    3732                z = [111, 222];
    3833                [u, v] = [123, 456];
    39                 printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
    40                 sout | "u=" | u | "v=" | v | "z=[" | z | "]" | endl;
     34                printf("u=%d v=%d z=[%d, %d]\n", u, v, z);
    4135        }
     36
    4237        {
    4338                // test mass assignment
     
    5348                // no conversion from X to integral types, so this serves as a santiy
    5449                // check that as long as this compiles, ?=?(_, x) is not generated.
    55                 [t, x, d, i, c, x] = (double)94.12;
    56                 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
    57                 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
    58                 [x, c, i, d, x, t] = (double)-94.12;
    59                 printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
    60                 sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]" | endl;
     50                [t, x, d, i, c, x] = (double)-2153.12;
     51                printf("d=%lg i=%d c=%d t=[%d, %lg, %d]\n", d, i, (int)c, t);
     52                [x, c, i, d, x, t] = (double)-2153.12;
     53                printf("d=%lg i=%d c=%d t=[%d, %lg, %d]\n", d, i, (int)c, t);
    6154        }
    6255}
Note: See TracChangeset for help on using the changeset viewer.