Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353951 - [fp] "No return, in function returning non-void" in do/while loop
Summary: [fp] "No return, in function returning non-void" in do/while loop
Status: CLOSED DUPLICATE of bug 394521
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: CDT Codan Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-04 22:07 EDT by Alastair D'Silva CLA
Modified: 2014-08-13 09:30 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alastair D'Silva CLA 2011-08-04 22:07:05 EDT
Build Identifier: I20110613-1736

"No return, in function returning non-void" is triggered in do/while loops.

Since the do loop always executes at least once, it is valid to return within it.

Reproducible: Always

Steps to Reproduce:
Create a C file with the following function

int test () {
	do {
		return 1;
	} while (0);
}
Comment 1 Soungjin Park CLA 2014-02-03 04:21:54 EST
Not fixed in Kepler CDT 8.2.1

Exactly same issue.

Many C coders may uses "do{...}while(0)"
for multi-statement block MACRO and for semicolon ending.
Comment 2 Nathan Ridge CLA 2014-08-13 01:58:13 EDT
This appears to be fixed by the patch for bug 394521. I think we can close as duplicate.
Comment 3 Elena Laskavaia CLA 2014-08-13 09:30:26 EDT

*** This bug has been marked as a duplicate of bug 394521 ***