Changeset 463cb33
- Timestamp:
- Jul 16, 2020, 2:59:56 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c82af9f
- Parents:
- 519f11c (diff), 3f06c05 (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. - Files:
-
- 3 added
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r519f11c r463cb33 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 8 22:14:20202013 // Update Count : 1 06912 // Last Modified On : Thu Jul 16 07:43:31 2020 13 // Update Count : 1102 14 14 // 15 15 … … 970 970 } // ?|? 971 971 972 #if defined( __SIZEOF_INT128__ ) 973 istype & ?|?( istype & is, int128 & i128 ) { 974 return (istype &)(is | (unsigned int128 &)i128); 975 } // ?|? 976 977 istype & ?|?( istype & is, unsigned int128 & ui128 ) { 978 char s[40]; 979 bool sign = false; 980 981 if ( fmt( is, " %[-]", s ) == 1 ) sign = true; // skip whitespace, negative sign ? 982 // If the input is too large, the value returned is undefined. If there is no input, no value is returned 983 if ( fmt( is, "%39[0-9]%*[0-9]", s ) == 1 ) { // take first 39 characters, ignore remaining 984 ui128 = 0; 985 for ( unsigned int i = 0; s[i] != '\0'; i += 1 ) { 986 ui128 = ui128 * 10 + s[i] - '0'; 987 } // for 988 if ( sign ) ui128 = -ui128; 989 } else if ( sign ) ungetc( is, '-' ); // return minus when no digits 990 return is; 991 } // ?|? 992 #endif // __SIZEOF_INT128__ 972 993 973 994 istype & ?|?( istype & is, float & f ) { -
libcfa/src/iostream.hfa
r519f11c r463cb33 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 13 22:11:41202013 // Update Count : 34 412 // Last Modified On : Thu Jul 16 07:43:32 2020 13 // Update Count : 348 14 14 // 15 15 … … 315 315 istype & ?|?( istype &, unsigned int & ); 316 316 istype & ?|?( istype &, long int & ); 317 istype & ?|?( istype &, unsigned long int & ); 317 318 istype & ?|?( istype &, long long int & ); 318 istype & ?|?( istype &, unsigned long int & );319 319 istype & ?|?( istype &, unsigned long long int & ); 320 #if defined( __SIZEOF_INT128__ ) 321 istype & ?|?( istype &, int128 & ); 322 istype & ?|?( istype &, unsigned int128 & ); 323 #endif // __SIZEOF_INT128__ 320 324 321 325 istype & ?|?( istype &, float & ); -
src/GenPoly/InstantiateGeneric.cc
r519f11c r463cb33 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Aug 04 18:33:00 2016 11 // Last Modified By : A aron B. Moss12 // Last Modified On : Thu Aug 04 18:33:00 201613 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 16 10:17:00 2020 13 // Update Count : 2 14 14 // 15 15 #include "InstantiateGeneric.h" … … 297 297 } 298 298 299 template< typename AggrInst > 300 static AggrInst * asForward( AggrInst * decl ) { 301 if ( !decl->body ) { 302 return nullptr; 303 } 304 decl = decl->clone(); 305 decl->body = false; 306 deleteAll( decl->members ); 307 decl->members.clear(); 308 return decl; 309 } 310 299 311 void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) { 300 312 substituteMembers( base->get_members(), baseParams, typeSubs ); … … 373 385 concDecl->set_body( inst->get_baseStruct()->has_body() ); 374 386 substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 375 insert( inst, typeSubs, concDecl ); // must insert before recursion 387 // Forward declare before recursion. (TODO: Only when needed, #199.) 388 insert( inst, typeSubs, concDecl ); 389 if ( StructDecl *forwardDecl = asForward( concDecl ) ) { 390 declsToAddBefore.push_back( forwardDecl ); 391 } 376 392 concDecl->acceptMutator( *visitor ); // recursively instantiate members 377 393 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first … … 423 439 concDecl->set_body( inst->get_baseUnion()->has_body() ); 424 440 substituteMembers( inst->get_baseUnion()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() ); 425 insert( inst, typeSubs, concDecl ); // must insert before recursion 441 // Forward declare before recursion. (TODO: Only when needed, #199.) 442 insert( inst, typeSubs, concDecl ); 443 if ( UnionDecl *forwardDecl = asForward( concDecl ) ) { 444 declsToAddBefore.push_back( forwardDecl ); 445 } 426 446 concDecl->acceptMutator( *visitor ); // recursively instantiate members 427 447 declsToAddBefore.push_back( concDecl ); // must occur before declaration is added so that member instantiations appear first -
src/Parser/ExpressionNode.cc
r519f11c r463cb33 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 13 21:12:02202013 // Update Count : 104 312 // Last Modified On : Wed Jul 15 08:24:08 2020 13 // Update Count : 1046 14 14 // 15 15 … … 222 222 } else { // octal int128 constant 223 223 unsigned int len = str.length(); 224 char buf[32];225 __int128 val = v;226 227 224 if ( len > 1 + 43 || (len == 1 + 43 && str[0] > '3') ) SemanticError( yylloc, "128-bit octal constant to large " + str ); 228 225 if ( len <= 1 + 21 ) { // value < 21 octal digitis … … 230 227 } else { 231 228 sscanf( &str[len - 21], "%llo", &v ); 232 val = v; // store bits229 __int128 val = v; // accumulate bits 233 230 str[len - 21] ='\0'; // shorten string 234 231 sscanf( &str[len == 43 ? 1 : 0], "%llo", &v ); … … 240 237 } // if 241 238 v = val >> 64; v2 = (uint64_t)val; // replace octal constant with 2 hex constants 239 char buf[32]; 242 240 sprintf( buf, "%#llx", v2 ); 243 241 str2 = buf; … … 256 254 #define P10_UINT64 10'000'000'000'000'000'000ULL // 19 zeroes 257 255 unsigned int len = str.length(); 258 char buf[32];259 __int128 val = v;260 261 256 if ( str.length() == 39 && str > (Unsigned ? "340282366920938463463374607431768211455" : "170141183460469231731687303715884105727") ) 262 257 SemanticError( yylloc, "128-bit decimal constant to large " + str ); … … 265 260 } else { 266 261 sscanf( &str[len - 19], "%llu", &v ); 267 val = v; // store bits262 __int128 val = v; // accumulate bits 268 263 str[len - 19] ='\0'; // shorten string 269 264 sscanf( &str[len == 39 ? 1 : 0], "%llu", &v ); … … 275 270 } // if 276 271 v = val >> 64; v2 = (uint64_t)val; // replace decimal constant with 2 hex constants 272 char buf[32]; 277 273 sprintf( buf, "%#llx", v2 ); 278 274 str2 = buf; -
tests/.expect/functions.x64.txt
r519f11c r463cb33 121 121 122 122 } 123 struct _conc__tuple2_0; 123 124 struct _conc__tuple2_0 { 124 125 signed int field_0; … … 157 158 158 159 } 160 struct _conc__tuple3_1; 159 161 struct _conc__tuple3_1 { 160 162 signed int field_0; … … 170 172 __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = { }; 171 173 } 174 struct _conc__tuple3_2; 172 175 struct _conc__tuple3_2 { 173 176 signed int field_0; … … 260 263 __attribute__ ((unused)) signed int *const _X10_retval_f3KPi_1; 261 264 } 265 struct _conc__tuple2_3; 262 266 struct _conc__tuple2_3 { 263 267 signed int *field_0; -
tests/.expect/functions.x86.txt
r519f11c r463cb33 121 121 122 122 } 123 struct _conc__tuple2_0; 123 124 struct _conc__tuple2_0 { 124 125 signed int field_0; … … 157 158 158 159 } 160 struct _conc__tuple3_1; 159 161 struct _conc__tuple3_1 { 160 162 signed int field_0; … … 170 172 __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = { }; 171 173 } 174 struct _conc__tuple3_2; 172 175 struct _conc__tuple3_2 { 173 176 signed int field_0; … … 260 263 __attribute__ ((unused)) signed int *const _X10_retval_f3KPi_1; 261 264 } 265 struct _conc__tuple2_3; 262 266 struct _conc__tuple2_3 { 263 267 signed int *field_0; -
tests/.in/manipulatorsInput.txt
r519f11c r463cb33 27 27 3.5 3.5 3.456E+23.456E+2 -0x1.2p-3 3.5 0X1.23p3 3.5 28 28 3.5 3.5 3.456E+23.456E+2 -0x1.2p-3 3.5 0X1.23p3 3.5 29 25 -25 42798 30 1402432282 1505850196993244515 31 394749758663249135511342 32 12935154696204706112391834394 33 34 423859149128410414395372834994551 35 36 37 13889016598639747063234935497057631587 38 170141183460469231731687303715884105727 39 340282366920938463463374607431768211455 40 -340282366920938463463374607431768211455 41 340282366920938463463374607431768211455999 42 1234567890123456789 -1234567890123456789 -
tests/manipulatorsInput.cfa
r519f11c r463cb33 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Thu Jun 13 17:41:43 201910 // Update Count : 379 // Last Modified On : Wed Jul 15 15:56:03 2020 10 // Update Count : 47 11 11 // 12 12 … … 152 152 sin | ignore( wdi( 8, ldc ) ); sout | ldc; 153 153 } 154 #if defined( __SIZEOF_INT128__ ) 155 { 156 int128 val; 157 for ( 15 ) { 158 sin | val; 159 sout | val; 160 } 161 } 162 #endif // __SIZEOF_INT128__ 154 163 } // main 155 164
Note: See TracChangeset
for help on using the changeset viewer.