| Summary: | Unnecessary "no break at the end of case" warning for "default" case | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nathan Ridge <zeratul976> |
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, malaperle, sducharme |
| Version: | 8.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Hi Nathan, You can disable this option by going in the project properties under C/C++ General / Code Analysis / No break at end of case / Customize Selected... / Check also the last "case" statement Thanks Simon, I didn't know about these "Customize" settings. I've marked the issue as resolved. |
Example: int main() { int x; switch (x) { case 1: { break; } case 2: { break; } default: { x = 0; } // WARNING HERE: "No break at the end of case" } } I think warning about no break at the end of a "default" case that occurs as the last case in a switch statement (or even more generally, about no break at the end of *any* case that is the last case in a switch statement) is unnecessary and should be removed.