| Summary: | Wrong warning "No return, in function returning non-void" | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Jens Seidel <jensseidel> |
| Component: | cdt-codan | Assignee: | Elena Laskavaia <elaskavaia.cdt> |
| Status: | RESOLVED FIXED | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | minor | ||
| Priority: | P3 | CC: | cdtdoug, divis1969, eclipse.sprigogin, ja324cl, jens.elmenthaler, willem.duminy, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | 8.6.0 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Note: In C++ the function name has to be anything different from `main` in order to observe this (main is a special case for C++) The warning goes off if anything's after the last return. I think the warning should say "dead code" here. Similar issue: bug 350168 What's the plan here? I think we're going to report dead code checker sooner or later. Alena, you wrote this checker so let me ask- how do you think, will it be worth it to find dead code in this checker too, or to write a new checker? I think it'll be better to make another checker, but the issues seem similar so I thought I'd ask. I think rather than blaming checker the code should be fixed to remove extra ";". I don't see any reason to have it there. This appears fixed in http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=16037a5f38845acb7194d12d70ba0ed6b5d04b90. Marking fixed. *** Bug 428021 has been marked as a duplicate of this bug. *** *** Bug 373880 has been marked as a duplicate of this bug. *** *** Bug 359201 has been marked as a duplicate of this bug. *** *** Bug 356908 has been marked as a duplicate of this bug. *** |
Build Identifier: 20110526-1053 The parser complains about "No return, in function returning non-void". Reproducible: Always Steps to Reproduce: int main() { return 3; /* bla bla*/; } Removing the last semicolon the warning disappears.