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

Bug 348386

Summary: Wrong warning "No return, in function returning non-void"
Product: [Tools] CDT Reporter: Jens Seidel <jensseidel>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: minor    
Priority: P3 CC: cdtdoug, divis1969, eclipse.sprigogin, ja324cl, jens.elmenthaler, willem.duminy, yevshif, zeratul976
Version: 8.0   
Target Milestone: 8.6.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Jens Seidel CLA 2011-06-06 08:34:48 EDT
Build Identifier: 20110526-1053

The parser complains about "No return, in function returning non-void".

Reproducible: Always

Steps to Reproduce:
int main()
{
	return 3;
	/* bla bla*/;
}

Removing the last semicolon the warning disappears.
Comment 1 Tomasz Wesolowski CLA 2011-07-28 10:34:51 EDT
Note: In C++ the function name has to be anything different from `main` in order to observe this (main is a special case for C++)

The warning goes off if anything's after the last return. I think the warning should say "dead code" here.
Comment 2 Tomasz Wesolowski CLA 2011-07-28 12:35:30 EDT
Similar issue: bug 350168

What's the plan here? I think we're going to report dead code checker sooner or later. Alena, you wrote this checker so let me ask- how do you think, will it be worth it to find dead code in this checker too, or to write a new checker?

I think it'll be better to make another checker, but the issues seem similar so I thought I'd ask.
Comment 3 Elena Laskavaia CLA 2011-12-20 22:39:57 EST
I think rather than blaming checker the code should be fixed to remove extra ";".
I don't see any reason to have it there.
Comment 5 Sergey Prigogin CLA 2015-08-10 16:37:28 EDT
Marking fixed.
Comment 6 Nathan Ridge CLA 2016-12-20 23:50:19 EST
*** Bug 428021 has been marked as a duplicate of this bug. ***
Comment 7 Nathan Ridge CLA 2016-12-22 18:44:39 EST
*** Bug 373880 has been marked as a duplicate of this bug. ***
Comment 8 Nathan Ridge CLA 2016-12-22 18:48:52 EST
*** Bug 359201 has been marked as a duplicate of this bug. ***
Comment 9 Nathan Ridge CLA 2016-12-22 18:49:18 EST
*** Bug 356908 has been marked as a duplicate of this bug. ***