Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2014-06-14 09:28:02 -0400
committerDoug Schaefer2014-06-16 10:26:43 -0400
commit16037a5f38845acb7194d12d70ba0ed6b5d04b90 (patch)
tree3a666760c4751fca771847ce66ae6ae0ced346e9 /codan/org.eclipse.cdt.codan.core.test
parent45a165b37d7a1c29d9867d32d11a7b5c8a975203 (diff)
downloadorg.eclipse.cdt-16037a5f38845acb7194d12d70ba0ed6b5d04b90.tar.gz
org.eclipse.cdt-16037a5f38845acb7194d12d70ba0ed6b5d04b90.tar.xz
org.eclipse.cdt-16037a5f38845acb7194d12d70ba0ed6b5d04b90.zip
Bug 350168 - Return checker won't report errors in dead code
Also Bug 356908, Bug 348386 Change-Id: I48d2f74e05d2d6d7a7bf0589408ca90bc07a6922 Reviewed-on: https://git.eclipse.org/r/28527 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.test')
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/internal/checkers/ReturnCheckerTest.java38
1 files changed, 38 insertions, 0 deletions
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 a350756921..d56ff169f0 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
@@ -346,4 +346,42 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkErrorLine(1);
}
+
+ // int retindead() {
+ // return 5;
+ // ;
+ // }
+ public void testRetInDeadCode1() throws Exception {
+ // bug 348386
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
+
+ // int retindead() {
+ // throw 42;
+ // ;
+ // }
+ public void testRetInDeadCodeThrow() throws Exception {
+ // bug 356908
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
+
+// bool func( int i )
+// {
+// switch( i )
+// {
+// case 0:
+// return true;
+// default:
+// return false;
+// break;
+// }
+// }
+ public void testRetInDeadCodeCase() throws Exception {
+ // Bug 350168
+ loadCodeAndRunCpp(getAboveComment());
+ checkNoErrors();
+ }
+
} \ No newline at end of file

Back to the top