Changes in / [b738974:3b5dcfa]
- Location:
- src
- Files:
-
- 2 edited
-
Common/SemanticError.h (modified) (4 diffs)
-
Parser/parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.h
rb738974 r3b5dcfa 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 4 14:08:26 202213 // Update Count : 3 512 // Last Modified On : Thu Jul 19 10:09:17 2018 13 // Update Count : 31 14 14 // 15 15 … … 59 59 {"aggregate-forward-decl" , Severity::Warn , "forward declaration of nested aggregate: %s" }, 60 60 {"superfluous-decl" , Severity::Warn , "declaration does not allocate storage: %s" }, 61 {"superfluous-else" , Severity::Warn , "else clause never executed for empty loop conditional" },62 61 {"gcc-attributes" , Severity::Warn , "invalid attribute: %s" }, 63 62 {"c++-like-copy" , Severity::Warn , "Constructor from reference is not a valid copy constructor" }, … … 70 69 AggrForwardDecl, 71 70 SuperfluousDecl, 72 SuperfluousElse,73 71 GccAttributes, 74 72 CppCopy, … … 81 79 ); 82 80 83 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, ##__VA_ARGS__)81 #define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, __VA_ARGS__) 84 82 85 83 void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4))); -
src/Parser/parser.yy
rb738974 r3b5dcfa 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 4 14:25:20202213 // Update Count : 527 712 // Last Modified On : Mon Mar 14 16:35:29 2022 13 // Update Count : 5276 14 14 // 15 15 … … 111 111 112 112 void distInl( DeclarationNode * declaration ) { 113 // distribute INLINEacross all declarations113 // distribute EXTENSION across all declarations 114 114 for ( DeclarationNode *iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 115 115 iter->set_inLine( true ); … … 1221 1221 1222 1222 iteration_statement: 1223 WHILE '(' ')' statement %prec THEN// CFA => while ( 1 )1223 WHILE '(' ')' statement // CFA => while ( 1 ) 1224 1224 { $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); } 1225 | WHILE '(' ')' statement ELSE statement // CFA1226 { SemanticWarning( yylloc, Warning::SuperfluousElse ); }1227 1225 | WHILE '(' conditional_declaration ')' statement %prec THEN 1228 1226 { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); } … … 1231 1229 | DO statement WHILE '(' ')' ';' // CFA => do while( 1 ) 1232 1230 { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) ); } 1233 | DO statement WHILE '(' ')' ELSE statement // CFA1234 { SemanticWarning( yylloc, Warning::SuperfluousElse ); }1235 1231 | DO statement WHILE '(' comma_expression ')' ';' %prec THEN 1236 1232 { $$ = new StatementNode( build_do_while( $5, maybe_build_compound( $2 ) ) ); } … … 2322 2318 { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2323 2319 2324 $$ = DeclarationNode::newEnum( nullptr, $7, true, $3 ) ->addQualifiers( $5 );2320 $$ = DeclarationNode::newEnum( nullptr, $7, true, $3 ) ->addQualifiers( $5 ); 2325 2321 } 2326 2322 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt identifier attribute_list_opt … … 2331 2327 '{' enumerator_list comma_opt '}' 2332 2328 { 2333 $$ = DeclarationNode::newEnum( $6, $10, true, $3 ) ->addQualifiers( $5 )->addQualifiers( $7 );2329 $$ = DeclarationNode::newEnum( $6, $10, true, $3 ) -> addQualifiers( $5 ) -> addQualifiers( $7 ); 2334 2330 } 2335 2331 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}' … … 2337 2333 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2338 2334 typedefTable.makeTypedef( *$6->name ); 2339 $$ = DeclarationNode::newEnum( $6->name, $9, true, $3 ) ->addQualifiers( $5 )->addQualifiers( $7 );2335 $$ = DeclarationNode::newEnum( $6->name, $9, true, $3 ) -> addQualifiers( $5 ) -> addQualifiers( $7 ); 2340 2336 } 2341 2337 | enum_type_nobody
Note:
See TracChangeset
for help on using the changeset viewer.