- Timestamp:
- May 23, 2017, 12:20:38 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 8bcaf21
- Parents:
- 2c9ebab (diff), 935315d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r2c9ebab r13099105 896 896 Parent::visit( compoundStmt ); 897 897 898 // add destructors for the current scope that we're exiting 898 // add destructors for the current scope that we're exiting, unless the last statement is a return, which 899 // causes unreachable code warnings 899 900 std::list< Statement * > & statements = compoundStmt->get_kids(); 900 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 901 if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) { 902 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 903 } 901 904 reverseDeclOrder.pop_front(); 902 905 } -
src/SymTab/Validate.cc
r2c9ebab r13099105 208 208 }; 209 209 210 /// ensure that generic types have the correct number of type arguments 211 class ValidateGenericParameters : public Visitor { 212 public: 213 typedef Visitor Parent; 214 virtual void visit( StructInstType * inst ) final override; 215 virtual void visit( UnionInstType * inst ) final override; 216 }; 217 210 218 class ArrayLength : public Visitor { 211 219 public: … … 235 243 Pass3 pass3( 0 ); 236 244 CompoundLiteral compoundliteral; 237 238 HoistStruct::hoistStruct( translationUnit ); 245 ValidateGenericParameters genericParams; 246 239 247 EliminateTypedef::eliminateTypedef( translationUnit ); 248 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 240 249 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 241 250 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 251 acceptAll( translationUnit, genericParams ); // check as early as possible - can't happen before LinkReferenceToTypes 242 252 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist 243 253 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors … … 829 839 } 830 840 841 template< typename Aggr > 842 void validateGeneric( Aggr * inst ) { 843 std::list< TypeDecl * > * params = inst->get_baseParameters(); 844 if ( params != NULL ) { 845 std::list< Expression * > & args = inst->get_parameters(); 846 if ( args.size() < params->size() ) throw SemanticError( "Too few type arguments in generic type ", inst ); 847 if ( args.size() > params->size() ) throw SemanticError( "Too many type arguments in generic type ", inst ); 848 } 849 } 850 851 void ValidateGenericParameters::visit( StructInstType * inst ) { 852 validateGeneric( inst ); 853 Parent::visit( inst ); 854 } 855 856 void ValidateGenericParameters::visit( UnionInstType * inst ) { 857 validateGeneric( inst ); 858 Parent::visit( inst ); 859 } 860 831 861 DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) { 832 862 storageClasses = objectDecl->get_storageClasses(); -
src/libcfa/gmp
r2c9ebab r13099105 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 14 23:47:36201713 // Update Count : 912 // Last Modified On : Mon May 22 08:32:39 2017 13 // Update Count : 13 14 14 // 15 15 … … 35 35 Int ?=?( Int * lhs, long int rhs ) { mpz_set_si( lhs->mpz, rhs ); return *lhs; } 36 36 Int ?=?( Int * lhs, unsigned long int rhs ) { mpz_set_ui( lhs->mpz, rhs ); return *lhs; } 37 //Int ?=?( Int * lhs, const char * rhs ) { if ( mpq_set_str( lhs->mpz, rhs, 0 ) ) abort();return *lhs; }37 Int ?=?( Int * lhs, const char * rhs ) { if ( mpz_set_str( lhs->mpz, rhs, 0 ) ) { printf( "invalid string conversion\n" ); abort(); } return *lhs; } 38 38 39 39 char ?=?( char * lhs, Int rhs ) { char val = mpz_get_si( rhs.mpz ); *lhs = val; return val; } -
src/tests/.expect/64/gmp.txt
r2c9ebab r13099105 4 4 conversions 5 5 y:97 6 y:12345678901234567890123456789 6 7 y:3 7 8 y:-3 … … 24 25 z:150000000000000000000 25 26 z:16666666666666666666 27 16666666666666666666, 2 16666666666666666666, 2 26 28 x:16666666666666666666 y:2 27 29 -
src/tests/gmp.c
r2c9ebab r13099105 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 14 14:46:50201713 // Update Count : 53 012 // Last Modified On : Mon May 22 09:05:09 2017 13 // Update Count : 538 14 14 // 15 15 16 16 #include <gmp> 17 17 18 int main( ) {18 int main( void ) { 19 19 sout | "constructors" | endl; 20 20 short int si = 3; … … 25 25 sout | "conversions" | endl; 26 26 y = 'a'; 27 sout | "y:" | y | endl; 28 y = "12345678901234567890123456789"; 27 29 sout | "y:" | y | endl; 28 30 y = si; … … 62 64 z = x / 3; 63 65 sout | "z:" | z | endl; 66 sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl; 64 67 [ x, y ] = div( x, 3 ); 65 68 sout | "x:" | x | "y:" | y | endl; 66 // sout | div( x, 3 ) | x / 3 | "," | x % 3 | endl;67 69 68 70 sout | endl; … … 72 74 fn = (Int){0}; fn1 = fn; // 1st case 73 75 sout | (int)0 | fn | endl; 74 fn = (Int){1}; fn2 = fn1; fn1 = fn;// 2nd case76 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 75 77 sout | 1 | fn | endl; 76 for ( int i = 2; i <= 200; i += 1 ) {78 for ( unsigned int i = 2; i <= 200; i += 1 ) { 77 79 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case 78 80 sout | i | fn | endl; … … 83 85 sout | "Factorial Numbers" | endl; 84 86 Int fact; 85 fact = (Int){1};// 1st case87 fact = 1; // 1st case 86 88 sout | (int)0 | fact | endl; 87 for ( int i = 1; i <= 40; i += 1 ) {89 for ( unsigned int i = 1; i <= 40; i += 1 ) { 88 90 fact = fact * i; // general case 89 91 sout | i | fact | endl;
Note: See TracChangeset
for help on using the changeset viewer.