Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345687 - [fp] "No return, in function returning non-void" for compound statement at the end
Summary: [fp] "No return, in function returning non-void" for compound statement at th...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0.1   Edit
Assignee: Elena Laskavaia CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-13 02:58 EDT by Jens Elmenthaler CLA
Modified: 2014-01-29 22:53 EST (History)
3 users (show)

See Also:


Attachments
fix and test (1.97 KB, patch)
2011-06-21 07:09 EDT, Tomasz Wesolowski CLA
cdtdoug: iplog+
Details | Diff

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