Changes in / [8a78dd3:56de6b39]
- Location:
- src
- Files:
-
- 2 edited
-
Parser/parser.yy (modified) (15 diffs)
-
tests/polymorphism.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r8a78dd3 r56de6b39 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 26 11:36:36 201713 // Update Count : 29 6912 // Last Modified On : Mon Nov 20 09:45:36 2017 13 // Update Count : 2945 14 14 // 15 15 … … 345 345 %type<en> type_list 346 346 347 %type<decl> type_qualifier type_qualifier_name foralltype_qualifier_list_opt type_qualifier_list347 %type<decl> type_qualifier type_qualifier_name type_qualifier_list_opt type_qualifier_list 348 348 %type<decl> type_specifier type_specifier_nobody 349 349 … … 379 379 // `---' matches start of TYPEGENname '(' 380 380 // Must be: 381 // Foo( int ) ( *fp )( int );381 // Foo( int ) ( *fp )( int ); 382 382 383 383 // Order of these lines matters (low-to-high precedence). … … 1058 1058 with_statement: 1059 1059 WITH '(' tuple_expression_list ')' statement 1060 { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; }// FIX ME1060 { $$ = nullptr; } // FIX ME 1061 1061 ; 1062 1062 … … 1064 1064 mutex_statement: 1065 1065 MUTEX '(' argument_expression_list ')' statement 1066 { throw SemanticError("Mutex statement is currently unimplemented."); $$ = nullptr; }// FIX ME1066 { $$ = nullptr; } // FIX ME 1067 1067 ; 1068 1068 … … 1280 1280 c_declaration pop ';' 1281 1281 | cfa_declaration pop ';' // CFA 1282 | STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C111283 { throw SemanticError("Static assert is currently unimplemented."); $$ = nullptr; } // FIX ME1284 1282 ; 1285 1283 … … 1589 1587 | ATOMIC 1590 1588 { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); } 1591 | forall 1592 ; 1593 1594 forall: 1595 FORALL '(' 1589 | FORALL '(' 1596 1590 { 1597 1591 typedefTable.enterScope(); … … 2380 2374 $$ = $2; 2381 2375 } 2382 | forall '{' external_definition_list '}' // CFA, namespace2383 2376 ; 2384 2377 … … 2406 2399 with_clause_opt: 2407 2400 // empty 2408 { $$ = nullptr; } 2401 { $$ = nullptr; } // FIX ME 2409 2402 | WITH '(' tuple_expression_list ')' 2410 { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; }// FIX ME2403 { $$ = nullptr; } // FIX ME 2411 2404 ; 2412 2405 … … 2425 2418 $$ = $2->addFunctionBody( $4 )->addType( $1 ); 2426 2419 } 2427 // handles default int return type, OBSOLESCENT (see 1)2428 2420 | type_qualifier_list function_declarator with_clause_opt compound_statement 2429 2421 { … … 2432 2424 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2433 2425 } 2434 // handles default int return type, OBSOLESCENT (see 1)2435 2426 | declaration_qualifier_list function_declarator with_clause_opt compound_statement 2436 2427 { … … 2439 2430 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2440 2431 } 2441 // handles default int return type, OBSOLESCENT (see 1)2442 2432 | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement 2443 2433 { … … 2455 2445 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addType( $1 ); 2456 2446 } 2457 // handles default int return type, OBSOLESCENT (see 1)2458 2447 | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2459 2448 { … … 2462 2451 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2463 2452 } 2464 // handles default int return type, OBSOLESCENT (see 1) 2453 2454 // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4) 2465 2455 | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2466 2456 { … … 2469 2459 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5 )->addQualifiers( $1 ); 2470 2460 } 2471 // handles default int return type, OBSOLESCENT (see 1)2472 2461 | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2473 2462 { -
src/tests/polymorphism.c
r8a78dd3 r56de6b39 47 47 S s; 48 48 s.i = i; 49 assert f(s.i == i, "struct operation fails in polymorphic context.");49 assert(s.i == i); 50 50 51 51 B b; … … 73 73 { 74 74 // test aggregates with polymorphic members 75 typedef __attribute__((aligned(8)))uint32_t x_type;76 typedef __attribute__((aligned(8)))uint64_t y_type;75 typedef uint32_t x_type; 76 typedef uint64_t y_type; 77 77 78 78 x_type x = 3; … … 89 89 // ensure that the size of aggregates with polymorphic members 90 90 // matches the size of the aggregates in a monomorphic context 91 assert f( struct_size(x, y) == sizeof(S), "struct size differs in polymorphic context.");92 assert f( union_size(x, y) == sizeof(U), "union size differs in polymorphic context.");91 assert( struct_size(x, y) == sizeof(S) ); 92 assert( union_size(x, y) == sizeof(U) ); 93 93 94 94 y_type ?=?(y_type & this, zero_t) { … … 111 111 u.f2 = 0; 112 112 u.f1 = x; 113 assert f(ret == u.f2, "union operation fails in polymorphic context.");113 assert(ret == u.f2); 114 114 } 115 115 }
Note:
See TracChangeset
for help on using the changeset viewer.