mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 22:05:44 +02:00
Bug 343767 - [fp] 'No return' warning when return in both if and else
This commit is contained in:
parent
6f411b236b
commit
a0ff5b6b4f
1 changed files with 35 additions and 0 deletions
|
@ -210,4 +210,39 @@ public class ReturnCheckerTest extends CheckerTestCase {
|
||||||
loadCodeAndRun(getAboveComment());
|
loadCodeAndRun(getAboveComment());
|
||||||
checkErrorLine(1);
|
checkErrorLine(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//int bar(int foo)
|
||||||
|
//{
|
||||||
|
// if(foo)
|
||||||
|
// return 0;
|
||||||
|
// else
|
||||||
|
// return 0;
|
||||||
|
//}
|
||||||
|
public void testBranches_Bug343767() {
|
||||||
|
loadCodeAndRunCpp(getAboveComment());
|
||||||
|
checkNoErrors();
|
||||||
|
}
|
||||||
|
// int f()
|
||||||
|
// {
|
||||||
|
// switch (g()) {
|
||||||
|
// case 1: return 1;
|
||||||
|
// case 2:
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
public void testBranchesSwitch_Bug343767() {
|
||||||
|
loadCodeAndRunCpp(getAboveComment());
|
||||||
|
checkNoErrors();
|
||||||
|
}
|
||||||
|
//int bar(int foo)
|
||||||
|
//{
|
||||||
|
// if(foo)
|
||||||
|
// return 0;
|
||||||
|
// else
|
||||||
|
// if (g()) return 0;
|
||||||
|
// else return 1;
|
||||||
|
//}
|
||||||
|
public void testBranches2_Bug343767() {
|
||||||
|
loadCodeAndRunCpp(getAboveComment());
|
||||||
|
checkNoErrors();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue