Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359202

Summary: False positive for No return, in function returning non-void
Product: [Tools] CDT Reporter: Dmitry Smirnov <divis1969>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, yevshif, zeratul976
Version: 8.0   
Target Milestone: 8.5   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Dmitry Smirnov CLA 2011-09-28 06:01:07 EDT
Build Identifier: 

The code below produces the warning, but the is a return.

int test2( int a ) {
    return 1;
    if( a == 1 ) a = 2;
}

Reproducible: Always
Comment 1 Elena Laskavaia CLA 2011-10-24 20:56:03 EDT
This is questionable practice. This is deadcode. Why do you have deadcode after return? Should not you fixing it in a first place?
Comment 2 Andrew Gvozdev CLA 2011-10-25 10:30:36 EDT
I think we should rather give "Dead code" warning here (rather than "No return"). Codan cannot count on perfect code in editor, it is normal to have unfinished unclean pieces of code while editing code under developing.
Comment 4 Elena Laskavaia CLA 2014-08-13 09:29:43 EDT
fixed