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

Bug 353951

Summary: [fp] "No return, in function returning non-void" in do/while loop
Product: [Tools] CDT Reporter: Alastair D'Silva <eclipse>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: CLOSED DUPLICATE QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, xcomart, yevshif, zeratul976
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

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 ***