Changes in / [a8616147:03286aa]
- Location:
- src
- Files:
-
- 15 edited
-
GenPoly/Box.cc (modified) (3 diffs)
-
InitTweak/FixGlobalInit.cc (modified) (3 diffs)
-
InitTweak/FixInit.cc (modified) (5 diffs)
-
InitTweak/FixInit.h (modified) (2 diffs)
-
InitTweak/GenInit.cc (modified) (5 diffs)
-
InitTweak/GenInit.h (modified) (2 diffs)
-
InitTweak/module.mk (modified) (2 diffs)
-
Makefile.in (modified) (6 diffs)
-
ResolvExpr/Resolver.cc (modified) (2 diffs)
-
SynTree/ArrayType.cc (modified) (2 diffs)
-
SynTree/Expression.cc (modified) (5 diffs)
-
SynTree/Initializer.cc (modified) (2 diffs)
-
SynTree/ObjectDecl.cc (modified) (2 diffs)
-
SynTree/Statement.cc (modified) (3 diffs)
-
examples/limits.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 14:51:21201612 // Last Modified On : Tue May 03 16:44:47 2016 13 13 // Update Count : 295 14 14 // … … 1037 1037 std::list< DeclarationWithType *>::iterator param = adapterType->get_parameters().begin(); 1038 1038 std::list< DeclarationWithType *>::iterator realParam = adaptee->get_parameters().begin(); 1039 param++; // skip adaptee parameter in the adapter type1039 param++; // skip adaptee parameter 1040 1040 if ( realType->get_returnVals().empty() ) { 1041 // void return1042 1041 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); 1043 1042 bodyStmt = new ExprStmt( noLabels, adapteeApp ); 1044 1043 } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) { 1045 // return type T1046 1044 if ( (*param)->get_name() == "" ) { 1047 1045 (*param)->set_name( "_ret" ); … … 2071 2069 if ( n_members == 0 ) { 2072 2070 // all empty structs have the same layout - size 1, align 1 2073 makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from_ulong( (unsigned long)1 ) ) ) );2074 makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from_ulong( (unsigned long)1 ) ) ) );2071 makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 2072 makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 2075 2073 // NOTE zero-length arrays are forbidden in C, so empty structs have no offsetof array 2076 2074 } else { -
src/InitTweak/FixGlobalInit.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 04 15:14:56 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:37:30201612 // Last Modified On : Mon May 09 11:44:29 2016 13 13 // Update Count : 2 14 14 // 15 15 16 16 #include "FixGlobalInit.h" 17 #include " InitTweak.h"17 #include "GenInit.h" 18 18 #include "SynTree/Declaration.h" 19 19 #include "SynTree/Type.h" … … 125 125 std::list< Statement * > & destroyStatements = destroyFunction->get_statements()->get_kids(); 126 126 127 //if ( objDecl->get_init() == NULL ) return;127 if ( objDecl->get_init() == NULL ) return; 128 128 if ( ! tryConstruct( objDecl ) ) return; // don't construct @= or designated objects 129 129 if ( objDecl->get_type()->get_isConst() ) return; // temporary: can't assign to a const variable 130 if ( objDecl->get_storageClass() == DeclarationNode::Extern ) return;131 130 // C allows you to initialize objects with constant expressions 132 131 // xxx - this is an optimization. Need to first resolve constructors before we decide … … 134 133 // if ( isConstExpr( objDecl->get_init() ) ) return; 135 134 136 if ( ArrayType * at = dynamic_cast< ArrayType * > ( objDecl->get_type() ) ) { 137 // xxx - initialize each element of the array 138 } else { 139 // steal initializer from object and attach it to a new temporary 140 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, objDecl->get_type()->clone(), objDecl->get_init() ); 141 objDecl->set_init( NULL ); 142 initStatements.push_back( new DeclStmt( noLabels, newObj ) ); 135 // steal initializer from object and attach it to a new temporary 136 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, objDecl->get_type()->clone(), objDecl->get_init() ); 137 objDecl->set_init( NULL ); 138 initStatements.push_back( new DeclStmt( noLabels, newObj ) ); 143 139 144 // copy construct objDecl using temporary145 UntypedExpr * init = new UntypedExpr( new NameExpr( "?{}" ) );146 init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) );147 init->get_args().push_back( new VariableExpr( newObj ) );148 initStatements.push_back( new ExprStmt( noLabels, init ) );140 // copy construct objDecl using temporary 141 UntypedExpr * init = new UntypedExpr( new NameExpr( "?{}" ) ); 142 init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 143 init->get_args().push_back( new VariableExpr( newObj ) ); 144 initStatements.push_back( new ExprStmt( noLabels, init ) ); 149 145 150 // add destructor calls to global destroy function 151 UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) ); 152 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 153 destroyStatements.push_front( new ExprStmt( noLabels, destroy ) ); 154 } 146 // add destructor calls to global destroy function 147 UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) ); 148 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 149 destroyStatements.push_front( new ExprStmt( noLabels, destroy ) ); 155 150 } 156 151 -
src/InitTweak/FixInit.cc
ra8616147 r03286aa 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:44:26201612 // Last Modified On : Mon May 09 12:36:02 2016 13 13 // Update Count : 30 14 14 // … … 17 17 #include <list> 18 18 #include "FixInit.h" 19 #include "InitTweak.h"20 19 #include "ResolvExpr/Resolver.h" 21 20 #include "ResolvExpr/typeops.h" … … 28 27 #include "SymTab/Indexer.h" 29 28 #include "GenPoly/PolyMutator.h" 29 #include "GenPoly/GenPoly.h" 30 30 31 31 bool ctordtorp = false; … … 398 398 } 399 399 400 bool isInstrinsicSingleArgCallStmt( Statement * stmt ) { 401 if ( stmt == NULL ) return false; 402 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) { 403 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( exprStmt->get_expr() ); 404 assert( appExpr ); 405 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() ); 406 assert( function ); 407 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 408 // will call all member dtors, and some members may have a user defined dtor. 409 FunctionType * funcType = GenPoly::getFunctionType( function->get_var()->get_type() ); 410 assert( funcType ); 411 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic && funcType->get_parameters().size() == 1; 412 } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) { 413 // could also be a compound statement with a loop, in the case of an array 414 assert( compoundStmt->get_kids().size() == 2 ); // loop variable and loop 415 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() ); 416 assert( forStmt && forStmt->get_body() ); 417 return isInstrinsicSingleArgCallStmt( forStmt->get_body() ); 418 } else { 419 // should never get here 420 assert( false && "encountered unknown call statement" ); 421 } 422 } 423 400 424 namespace { 401 425 template<typename Iterator, typename OutputIterator> … … 404 428 // remove if instrinsic destructor statement. Note that this is only called 405 429 // on lists of implicit dtors, so if the user manually calls an intrinsic 406 // dtor then the call must (and will) still be generated since the argument 407 // may contain side effects. 430 // dtor then the call will still be generated 408 431 if ( ! isInstrinsicSingleArgCallStmt( *it ) ) { 409 432 // don't need to call intrinsic dtor, because it does nothing, but -
src/InitTweak/FixInit.h
ra8616147 r03286aa 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:27:52201612 // Last Modified On : Mon May 09 12:08:11 2016 13 13 // Update Count : 5 14 14 // … … 28 28 /// and unwrap basic C-style initializers 29 29 void fix( std::list< Declaration * > & translationUnit ); 30 31 /// True if stmt is a call statement where the function called is intrinsic and takes one parameter. 32 /// Intended to be used for default ctor/dtor calls, but might have use elsewhere. 33 /// Currently has assertions that make it less than fully general. 34 bool isInstrinsicSingleArgCallStmt( Statement * expr ); 30 35 } // namespace 31 36 -
src/InitTweak/GenInit.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:37:48201612 // Last Modified On : Fri May 06 16:11:15 2016 13 13 // Update Count : 166 14 14 // … … 17 17 #include <list> 18 18 #include "GenInit.h" 19 #include "InitTweak.h"20 19 #include "SynTree/Declaration.h" 21 20 #include "SynTree/Type.h" … … 130 129 } 131 130 131 bool tryConstruct( ObjectDecl * objDecl ) { 132 // xxx - handle designations 133 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) && 134 (objDecl->get_init() == NULL || 135 ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() )); 136 } 132 137 namespace { 138 133 139 Expression * makeCtorDtorExpr( std::string name, ObjectDecl * objDecl, std::list< Expression * > args ) { 134 140 UntypedExpr * expr = new UntypedExpr( new NameExpr( name ) ); … … 136 142 expr->get_args().splice( expr->get_args().end(), args ); 137 143 return expr; 144 } 145 146 class InitExpander : public Visitor { 147 public: 148 InitExpander() {} 149 // ~InitExpander() {} 150 virtual void visit( SingleInit * singleInit ); 151 virtual void visit( ListInit * listInit ); 152 std::list< Expression * > argList; 153 }; 154 155 void InitExpander::visit( SingleInit * singleInit ) { 156 argList.push_back( singleInit->get_value()->clone() ); 157 } 158 159 void InitExpander::visit( ListInit * listInit ) { 160 // xxx - for now, assume no nested list inits 161 std::list<Initializer*>::iterator it = listInit->begin_initializers(); 162 for ( ; it != listInit->end_initializers(); ++it ) { 163 (*it)->accept( *this ); 164 } 165 } 166 167 std::list< Expression * > makeInitList( Initializer * init ) { 168 InitExpander expander; 169 maybeAccept( init, expander ); 170 return expander.argList; 138 171 } 139 172 } … … 146 179 // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array 147 180 // TODO: walk initializer and generate appropriate copy ctor if element has initializer 148 std::list< Expression * > args = makeInitList( objDecl->get_init() ); 149 if ( args.empty() ) { 150 std::list< Statement * > ctor; 151 std::list< Statement * > dtor; 152 153 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( ctor ) ); 154 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( dtor ), false ); 155 156 // Currently makeArrayFunction produces a single Statement - a CompoundStmt 157 // which wraps everything that needs to happen. As such, it's technically 158 // possible to use a Statement ** in the above calls, but this is inherently 159 // unsafe, so instead we take the slightly less efficient route, but will be 160 // immediately informed if somehow the above assumption is broken. In this case, 161 // we could always wrap the list of statements at this point with a CompoundStmt, 162 // but it seems reasonable at the moment for this to be done by makeArrayFunction 163 // itself 164 assert( ctor.size() == 1 ); 165 assert( dtor.size() == 1 ); 166 167 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) ); 168 } else { 169 // array came with an initializer list: initialize each element 170 // may have more initializers than elements in the array - need to check at each index that 171 // we haven't exceeded size. This requires precomputing the size because it might be a side-effecting 172 // computation. 173 // may have fewer initializers than eleemnts in the array - need to default construct 174 // remaining elements. 175 // might be able to merge this with the case above. 176 } 181 std::list< Statement * > ctor; 182 std::list< Statement * > dtor; 183 184 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( ctor ) ); 185 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( dtor ), false ); 186 187 // Currently makeArrayFunction produces a single Statement - a CompoundStmt 188 // which wraps everything that needs to happen. As such, it's technically 189 // possible to use a Statement ** in the above calls, but this is inherently 190 // unsafe, so instead we take the slightly less efficient route, but will be 191 // immediately informed if somehow the above assumption is broken. In this case, 192 // we could always wrap the list of statements at this point with a CompoundStmt, 193 // but it seems reasonable at the moment for this to be done by makeArrayFunction 194 // itself 195 assert( ctor.size() == 1 ); 196 assert( dtor.size() == 1 ); 197 198 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) ); 177 199 } else { 178 200 // it's sufficient to attempt to call the ctor/dtor for the given object and its initializer -
src/InitTweak/GenInit.h
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:27:19201612 // Last Modified On : Fri May 06 16:18:22 2016 13 13 // Update Count : 3 14 14 // … … 27 27 /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes 28 28 void genInit( std::list< Declaration * > & translationUnit ); 29 /// True if the resolver should try to construct objDecl 30 bool tryConstruct( ObjectDecl * objDecl ); 29 31 } // namespace 30 32 -
src/InitTweak/module.mk
ra8616147 r03286aa 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Rob Schluntz 13 ## Last Modified On : Fri May 13 11:36:24201613 ## Last Modified On : Fri May 06 15:59:27 2016 14 14 ## Update Count : 3 15 15 ############################################################################### … … 17 17 SRC += InitTweak/GenInit.cc \ 18 18 InitTweak/FixInit.cc \ 19 InitTweak/FixGlobalInit.cc \ 20 InitTweak/InitTweak.cc 19 InitTweak/FixGlobalInit.cc 21 20 -
src/Makefile.in
ra8616147 r03286aa 126 126 InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT) \ 127 127 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) \ 128 InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT) \129 128 Parser/driver_cfa_cpp-parser.$(OBJEXT) \ 130 129 Parser/driver_cfa_cpp-lex.$(OBJEXT) \ … … 351 350 GenPoly/DeclMutator.cc InitTweak/GenInit.cc \ 352 351 InitTweak/FixInit.cc InitTweak/FixGlobalInit.cc \ 353 InitTweak/InitTweak.cc Parser/parser.yy Parser/lex.ll \ 354 Parser/TypedefTable.cc Parser/ParseNode.cc \ 355 Parser/DeclarationNode.cc Parser/ExpressionNode.cc \ 356 Parser/StatementNode.cc Parser/InitializerNode.cc \ 357 Parser/TypeData.cc Parser/LinkageSpec.cc \ 358 Parser/parseutility.cc Parser/Parser.cc \ 352 Parser/parser.yy Parser/lex.ll Parser/TypedefTable.cc \ 353 Parser/ParseNode.cc Parser/DeclarationNode.cc \ 354 Parser/ExpressionNode.cc Parser/StatementNode.cc \ 355 Parser/InitializerNode.cc Parser/TypeData.cc \ 356 Parser/LinkageSpec.cc Parser/parseutility.cc Parser/Parser.cc \ 359 357 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 360 358 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 573 571 InitTweak/$(DEPDIR)/$(am__dirstamp) 574 572 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT): \ 575 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)576 InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT): \577 573 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp) 578 574 Parser/parser.h: Parser/parser.cc … … 810 806 -rm -f InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT) 811 807 -rm -f InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT) 812 -rm -f InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT)813 808 -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT) 814 809 -rm -f Parser/driver_cfa_cpp-ExpressionNode.$(OBJEXT) … … 919 914 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Po@am__quote@ 920 915 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Po@am__quote@ 921 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po@am__quote@922 916 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po@am__quote@ 923 917 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Po@am__quote@ … … 1431 1425 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi` 1432 1426 1433 InitTweak/driver_cfa_cpp-InitTweak.o: InitTweak/InitTweak.cc1434 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-InitTweak.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo -c -o InitTweak/driver_cfa_cpp-InitTweak.o `test -f 'InitTweak/InitTweak.cc' || echo '$(srcdir)/'`InitTweak/InitTweak.cc1435 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po1436 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/InitTweak.cc' object='InitTweak/driver_cfa_cpp-InitTweak.o' libtool=no @AMDEPBACKSLASH@1437 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1438 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-InitTweak.o `test -f 'InitTweak/InitTweak.cc' || echo '$(srcdir)/'`InitTweak/InitTweak.cc1439 1440 InitTweak/driver_cfa_cpp-InitTweak.obj: InitTweak/InitTweak.cc1441 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-InitTweak.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo -c -o InitTweak/driver_cfa_cpp-InitTweak.obj `if test -f 'InitTweak/InitTweak.cc'; then $(CYGPATH_W) 'InitTweak/InitTweak.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/InitTweak.cc'; fi`1442 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po1443 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/InitTweak.cc' object='InitTweak/driver_cfa_cpp-InitTweak.obj' libtool=no @AMDEPBACKSLASH@1444 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1445 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-InitTweak.obj `if test -f 'InitTweak/InitTweak.cc'; then $(CYGPATH_W) 'InitTweak/InitTweak.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/InitTweak.cc'; fi`1446 1447 1427 Parser/driver_cfa_cpp-parser.o: Parser/parser.cc 1448 1428 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parser.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo -c -o Parser/driver_cfa_cpp-parser.o `test -f 'Parser/parser.cc' || echo '$(srcdir)/'`Parser/parser.cc -
src/ResolvExpr/Resolver.cc
ra8616147 r03286aa 10 10 // Created On : Sun May 17 12:17:01 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 11:36:40201612 // Last Modified On : Mon May 09 12:10:19 2016 13 13 // Update Count : 203 14 14 // … … 25 25 #include "SymTab/Indexer.h" 26 26 #include "Common/utility.h" 27 #include "InitTweak/ InitTweak.h"27 #include "InitTweak/FixInit.h" 28 28 29 29 #include <iostream> -
src/SynTree/ArrayType.cc
ra8616147 r03286aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ArrayType.cc -- 7 // ArrayType.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu May 12 14:07:16 201612 // Last Modified On : Wed Aug 12 14:19:07 2015 13 13 // Update Count : 11 14 14 // … … 51 51 if ( dimension ) { 52 52 os << " with dimension of "; 53 dimension->print( os, indent);53 dimension->print( os, 0 ); 54 54 } // if 55 55 } -
src/SynTree/Expression.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 13:23:11 201612 // Last Modified On : Wed May 04 12:17:51 2016 13 13 // Update Count : 40 14 14 // … … 75 75 constant.print( os ); 76 76 Expression::print( os, indent ); 77 os << std::endl; 77 78 } 78 79 … … 324 325 os << ", from aggregate: "; 325 326 if (agg != 0) { 326 os << std::string( indent + 2, ' ' );327 327 agg->print(os, indent + 2); 328 328 } … … 360 360 os << std::string( indent, ' ' ) << "from aggregate: " << std::endl; 361 361 if (agg != 0) { 362 os << std::string( indent + 2, ' ' );363 362 agg->print(os, indent + 2); 364 363 } … … 382 381 void UntypedExpr::print( std::ostream &os, int indent ) const { 383 382 os << "Applying untyped: " << std::endl; 384 os << std::string( indent+ 2, ' ' );385 function->print(os, indent + 2);383 os << std::string( indent+4, ' ' ); 384 function->print(os, indent + 4); 386 385 os << std::string( indent, ' ' ) << "...to: " << std::endl; 387 printAll(args, os, indent + 2);386 printAll(args, os, indent + 4); 388 387 Expression::print( os, indent ); 389 388 } -
src/SynTree/Initializer.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 13:23:03201612 // Last Modified On : Tue Apr 26 15:51:35 2016 13 13 // Update Count : 28 14 14 // … … 49 49 50 50 if ( ! designators.empty() ) { 51 os << std::endl << std::string(indent + 2, ' ' ) << "designated by: " << std::endl;51 os << std::endl << std::string(indent + 2, ' ' ) << "designated by: " << std::endl; 52 52 for ( std::list < Expression * >::iterator i = designators.begin(); i != designators.end(); i++ ) { 53 os << std::string(indent + 4, ' ' );54 53 ( *i )->print(os, indent + 4 ); 55 54 } -
src/SynTree/ObjectDecl.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri May 13 13:23:32201612 // Last Modified On : Wed May 04 12:18:28 2016 13 13 // Update Count : 30 14 14 // … … 57 57 58 58 if ( init ) { 59 os << std::string(indent, ' '); 59 60 os << " with initializer "; 60 61 init->print( os, indent ); 61 os << std::endl << std::string(indent, ' '); 62 os << "maybeConstructed? " << init->get_maybeConstructed(); 62 os << std::string(indent, ' ') << "maybeConstructed? " << init->get_maybeConstructed(); 63 63 } // if 64 64 -
src/SynTree/Statement.cc
ra8616147 r03286aa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu May 12 13:33:18201612 // Last Modified On : Thu Apr 28 13:34:32 2016 13 13 // Update Count : 54 14 14 // … … 43 43 44 44 void ExprStmt::print( std::ostream &os, int indent ) const { 45 os << "Expression Statement:" << endl << std::string( indent + 2, ' ' );45 os << "Expression Statement:" << endl << std::string( indent, ' ' ); 46 46 expr->print( os, indent + 2 ); 47 47 } … … 290 290 os << string( indent + 2, ' ' ) << "initialization: \n"; 291 291 for ( std::list<Statement *>::const_iterator it = initialization.begin(); it != initialization.end(); ++it ) { 292 os << string( indent + 4, ' ' );293 292 (*it)->print( os, indent + 4 ); 294 293 } 295 294 296 295 os << "\n" << string( indent + 2, ' ' ) << "condition: \n"; 297 if ( condition != 0 ) { 298 os << string( indent + 4, ' ' ); 296 if ( condition != 0 ) 299 297 condition->print( os, indent + 4 ); 300 }301 298 302 299 os << "\n" << string( indent + 2, ' ' ) << "increment: \n"; 303 if ( increment != 0 ) { 304 os << string( indent + 4, ' ' ); 300 if ( increment != 0 ) 305 301 increment->print( os, indent + 4 ); 306 }307 302 308 303 os << "\n" << string( indent + 2, ' ' ) << "statement block: \n"; 309 if ( body != 0 ) { 310 os << string( indent + 4, ' ' ); 304 if ( body != 0 ) 311 305 body->print( os, indent + 4 ); 312 }313 306 314 307 os << endl; -
src/examples/limits.c
ra8616147 r03286aa 1 //2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // limits.c --8 //9 // Author : Peter A. Buhr10 // Created On : Tue May 10 20:44:20 201611 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue May 10 20:45:28 201613 // Update Count : 114 //15 16 1 #include <limits> 17 2 3 int main() { 18 4 // Integral Constants 19 5 20 short int m = MIN;21 int m = MIN;22 long int m = MIN;23 long long int m = MIN;6 short int m = MIN; 7 int m = MIN; 8 long int m = MIN; 9 long long int m = MIN; 24 10 25 short int M = MAX;26 unsigned short int M = MAX;27 int M = MAX;28 unsigned int M = MAX;29 long int M = MAX;30 unsigned long int M = MAX;31 long long int M = MAX;32 unsigned long long int M = MAX;11 short int M = MAX; 12 unsigned short int M = MAX; 13 int M = MAX; 14 unsigned int M = MAX; 15 long int M = MAX; 16 unsigned long int M = MAX; 17 long long int M = MAX; 18 unsigned long long int M = MAX; 33 19 34 20 // Floating-Point Constants 35 21 36 float pi = PI;37 float pi_2 = PI_2;38 float pi_4 = PI_4;39 float _1_pi = _1_PI;40 float _2_pi = _2_PI;41 float _2_sqrt_pi = _2_SQRT_PI;22 float pi = PI; 23 float pi_2 = PI_2; 24 float pi_4 = PI_4; 25 float _1_pi = _1_PI; 26 float _2_pi = _2_PI; 27 float _2_sqrt_pi = _2_SQRT_PI; 42 28 43 double pi = PI;44 double pi_2 = PI_2;45 double pi_4 = PI_4;46 double _1_pi = _1_PI;47 double _2_pi = _2_PI;48 double _2_SQRT_pi = _2_SQRT_PI;29 double pi = PI; 30 double pi_2 = PI_2; 31 double pi_4 = PI_4; 32 double _1_pi = _1_PI; 33 double _2_pi = _2_PI; 34 double _2_SQRT_pi = _2_SQRT_PI; 49 35 50 long double pi = PI;51 long double pi_2 = PI_2;52 long double pi_4 = PI_4;53 long double _1_pi = _1_PI;54 long double _2_pi = _2_PI;55 long double _2_sqrt_pi = _2_SQRT_PI;36 long double pi = PI; 37 long double pi_2 = PI_2; 38 long double pi_4 = PI_4; 39 long double _1_pi = _1_PI; 40 long double _2_pi = _2_PI; 41 long double _2_sqrt_pi = _2_SQRT_PI; 56 42 57 _Complex pi = PI;58 _Complex pi_2 = PI_2;59 _Complex pi_4 = PI_4;60 _Complex _1_pi = _1_PI;61 _Complex _2_pi = _2_PI;62 _Complex _2_sqrt_pi = _2_SQRT_PI;43 _Complex pi = PI; 44 _Complex pi_2 = PI_2; 45 _Complex pi_4 = PI_4; 46 _Complex _1_pi = _1_PI; 47 _Complex _2_pi = _2_PI; 48 _Complex _2_sqrt_pi = _2_SQRT_PI; 63 49 64 long _Complex pi = PI;65 long _Complex pi_2 = PI_2;66 long _Complex pi_4 = PI_4;67 long _Complex _1_pi = _1_PI;68 long _Complex _2_pi = _2_PI;69 long _Complex _2_sqrt_pi = _2_SQRT_PI;50 long _Complex pi = PI; 51 long _Complex pi_2 = PI_2; 52 long _Complex pi_4 = PI_4; 53 long _Complex _1_pi = _1_PI; 54 long _Complex _2_pi = _2_PI; 55 long _Complex _2_sqrt_pi = _2_SQRT_PI; 70 56 71 float e = E;72 float log2_e = LOG2_E;73 float log10_e = LOG10_E;74 float ln_2 = LN_2;75 float ln_10 = LN_10;76 float sqrt_2 = SQRT_2;77 float _1_sqrt_2 = _1_SQRT_2;57 float e = E; 58 float log2_e = LOG2_E; 59 float log10_e = LOG10_E; 60 float ln_2 = LN_2; 61 float ln_10 = LN_10; 62 float sqrt_2 = SQRT_2; 63 float _1_sqrt_2 = _1_SQRT_2; 78 64 79 double e = E;80 double log2_e = LOG2_E;81 double log10_e = LOG10_E;82 double ln_2 = LN_2;83 double ln_10 = LN_10;84 double sqrt_2 = SQRT_2;85 double _1_sqrt_2 = _1_SQRT_2;65 double e = E; 66 double log2_e = LOG2_E; 67 double log10_e = LOG10_E; 68 double ln_2 = LN_2; 69 double ln_10 = LN_10; 70 double sqrt_2 = SQRT_2; 71 double _1_sqrt_2 = _1_SQRT_2; 86 72 87 long double e = E;88 long double log2_e = LOG2_E;89 long double log10_e = LOG10_E;90 long double ln_2 = LN_2;91 long double ln_10 = LN_10;92 long double sqrt_2 = SQRT_2;93 long double _1_sqrt_2 = _1_SQRT_2;73 long double e = E; 74 long double log2_e = LOG2_E; 75 long double log10_e = LOG10_E; 76 long double ln_2 = LN_2; 77 long double ln_10 = LN_10; 78 long double sqrt_2 = SQRT_2; 79 long double _1_sqrt_2 = _1_SQRT_2; 94 80 95 _Complex e = E;96 _Complex log2_e = LOG2_E;97 _Complex log10_e = LOG10_E;98 _Complex ln_2 = LN_2;99 _Complex ln_10 = LN_10;100 _Complex sqrt_2 = SQRT_2;101 _Complex _1_sqrt_2 = _1_SQRT_2;81 _Complex e = E; 82 _Complex log2_e = LOG2_E; 83 _Complex log10_e = LOG10_E; 84 _Complex ln_2 = LN_2; 85 _Complex ln_10 = LN_10; 86 _Complex sqrt_2 = SQRT_2; 87 _Complex _1_sqrt_2 = _1_SQRT_2; 102 88 103 long _Complex e = E; 104 long _Complex log2_e = LOG2_E; 105 long _Complex log10_e = LOG10_E; 106 long _Complex ln_2 = LN_2; 107 long _Complex ln_10 = LN_10; 108 long _Complex sqrt_2 = SQRT_2; 109 long _Complex _1_sqrt_2 = _1_SQRT_2; 89 long _Complex e = E; 90 long _Complex log2_e = LOG2_E; 91 long _Complex log10_e = LOG10_E; 92 long _Complex ln_2 = LN_2; 93 long _Complex ln_10 = LN_10; 94 long _Complex sqrt_2 = SQRT_2; 95 long _Complex _1_sqrt_2 = _1_SQRT_2; 96 } 110 97 111 98 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.