Community
Participate
Working Groups
Build Identifier: Build id: 20110615-0604 "No return in function returning non-void" reported for the following: bool func( int i ) { switch( i ) { case 0: return true; default: return false; break; } } If I remove the final break statement then the problem goes away. The break statement is unreachable and therefore totally useless; but it seems to be confusing the checker. Reproducible: Always
Yes, dead code confuses the checker- looks like the same issue as in bug 348386
I am seeing something similar in latest trunk (Build id: 20111215-0110), but I don't think it's necessarily related to dead code: inline const char *ICAP_Scan_status_to_string(ICAP_Scan_status iss) { switch (iss) { case ISS_NOT_SCANNED: return "ICAP_COMMUNICATION_ERROR"; case ISS_NO_MODIFICATION: return "ICAP_NO_MODIFICATION"; case ISS_REPLACEMENT: return "ICAP_REPLACED"; case ISS_SCAN_IN_PROGRESS: return "ISS_SCAN_IN_PROGRESS"; case ISS_CORRUPT_UNSCANNED_OBJECT: return "ISS_CORRUPT_UNSCANNED_OBJECT"; default: return "unknown"; } } Here, this switch doesn't cover all of the cases in the enum -- the default case isn't dead code (not that I think CODAN is thinking *that* deeply about it ;)). All paths return a value, so this is a false positive.
Can you send another bug about this - this seems to be a different issue
Done. https://bugs.eclipse.org/bugs/show_bug.cgi?id=367377
This appears to be fixed in http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=16037a5f38845acb7194d12d70ba0ed6b5d04b90.
fixed