Skip to content
Snippets Groups Projects
Commit 988ec82b authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Check for unnecessary semicolons after function definitions.

parent f618a9a2
No related branches found
No related tags found
No related merge requests found
...@@ -347,8 +347,17 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast) ...@@ -347,8 +347,17 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
int previousVisibility = semantic()->switchVisibility(visibility); int previousVisibility = semantic()->switchVisibility(visibility);
int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod); int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
for (DeclarationListAST *member = ast->member_specifier_list; member; member = member->next) { DeclarationAST *previousDeclaration = 0;
semantic()->check(member->value, klass->members()); for (DeclarationListAST *it = ast->member_specifier_list; it; it = it->next) {
DeclarationAST *declaration = it->value;
semantic()->check(declaration, klass->members());
if (previousDeclaration && declaration &&
declaration->asEmptyDeclaration() != 0 &&
previousDeclaration->asFunctionDefinition() != 0)
translationUnit()->warning(declaration->firstToken(), "unnecessary semicolon after function body");
previousDeclaration = declaration;
} }
(void) semantic()->switchMethodKey(previousMethodKey); (void) semantic()->switchMethodKey(previousMethodKey);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment