Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359202 - False positive for No return, in function returning non-void
Summary: False positive for No return, in function returning non-void
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.5   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 06:01 EDT by Dmitry Smirnov CLA
Modified: 2014-08-13 09:29 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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