summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Wesolowski2011-06-27 20:29:36 (EDT)
committer Alena Laskavaia2011-06-27 20:32:54 (EDT)
commit8ad690e18aed9e9a30f8bbfe5418b3ccc53f4c8c (patch)
treea9d09db6dc0b3132c0aa398c8a6b073f56bf050a
parent5343d22eea13e14946333e76d216e2bda67b959e (diff)
downloadorg.eclipse.cdt-8ad690e18aed9e9a30f8bbfe5418b3ccc53f4c8c.zip
org.eclipse.cdt-8ad690e18aed9e9a30f8bbfe5418b3ccc53f4c8c.tar.gz
org.eclipse.cdt-8ad690e18aed9e9a30f8bbfe5418b3ccc53f4c8c.tar.bz2
Bug 345687 - [fp] "No return, in function returning non-void" for
compound statement at the end
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java10
2 files changed, 11 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index b917dec..86a9d9e 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -192,7 +192,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
*/
private boolean isCompoundStatement(IASTStatement last) {
return last instanceof IASTIfStatement || last instanceof IASTWhileStatement || last instanceof IASTDoStatement
- || last instanceof IASTForStatement || last instanceof IASTSwitchStatement;
+ || last instanceof IASTForStatement || last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
}
protected boolean isFuncExitStatement(IASTStatement statement) {
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
index b69f416..aba8192 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java
@@ -256,6 +256,16 @@ public class ReturnCheckerTest extends CheckerTestCase {
checkErrorLine(1);
}
+ // int f345687() {
+ // {
+ // return 0;
+ // }
+ // }
+ public void testNextedBlock_Bug345687() {
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
+
// int
// fp_goto(int a)
// {