mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 352983 - internal error in switch isFallThroughStatement
This commit is contained in:
parent
579f5aa0ec
commit
74ecb38ea3
2 changed files with 17 additions and 2 deletions
|
@ -139,7 +139,11 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
|
|||
if (body == null) return true;
|
||||
if (body instanceof IASTCompoundStatement) {
|
||||
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
|
||||
return isFallThroughStamement(statements[statements.length - 1]);
|
||||
if (statements.length > 0) {
|
||||
return isFallThroughStamement(statements[statements.length - 1]);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (isBreakOrExitStatement(body)) {
|
||||
return false;
|
||||
} else if (body instanceof IASTExpressionStatement) {
|
||||
|
|
|
@ -558,5 +558,16 @@ public class CaseBreakCheckerTest extends CheckerTestCase {
|
|||
checkNoErrors();
|
||||
}
|
||||
|
||||
|
||||
//void foo()
|
||||
//{
|
||||
//switch(0)
|
||||
//default:
|
||||
//{
|
||||
//}
|
||||
//}
|
||||
public void testEmptyCompoundStatement() {
|
||||
String code = getAboveComment();
|
||||
loadCodeAndRun(code);
|
||||
checkErrorLine(4);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue