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

Bug 342906

Summary: [fn] No warning if only one of an if/else pair has a return statement
Product: [Tools] CDT Reporter: Nathan Ridge <zeratul976>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:

Description Nathan Ridge CLA 2011-04-14 20:58:57 EDT
For the following code:

bool g();
void h();

int f()
{
    if (g())
        h();
    else
        return 0;
}

Codan does not issue a warning about having no return statement in the if branch.

gcc gives a warning about this (with -Wall), shouldn't Codan do it too?
Comment 1 Elena Laskavaia CLA 2011-04-24 22:14:28 EDT
Added support for this. Probably would be a lot more false positives after this fix...