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

Bug 345687

Summary: [fp] "No return, in function returning non-void" for compound statement at the end
Product: [Tools] CDT Reporter: Jens Elmenthaler <jens.elmenthaler>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, kosashi, malaperle
Version: 7.0   
Target Milestone: 8.0.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix and test cdtdoug: iplog+

Description Jens Elmenthaler CLA 2011-05-13 02:58:15 EDT
Build Identifier: CDT 8.0

create a fuction with the following code:
int main() {
  {
    return 0;
  }
}

The function is marked as "No return, in function returning non-void"

This may look like stupid code in the beginning, but in C/C++ you use nested scopes to control how long a mutex is locked, e.g.

int doSomething() {
  // Some work here

  {
    // Begin of a synchronised block.
    Guard<mutex> guard;

    // More work...

    // End of a synchronised block.

    return 0;
  }
}


Reproducible: Always
Comment 1 Tomasz Wesolowski CLA 2011-06-21 07:09:32 EDT
Created attachment 198321 [details]
fix and test

This solves the problem
Comment 2 Elena Laskavaia CLA 2011-06-27 21:41:30 EDT
fixed on cdt.8.0 and head
thanks for the patch