Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348386 - Wrong warning "No return, in function returning non-void"
Summary: Wrong warning "No return, in function returning non-void"
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 8.6.0   Edit
Assignee: Elena Laskavaia CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
: 356908 359201 373880 428021 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-06 08:34 EDT by Jens Seidel CLA
Modified: 2016-12-28 05:29 EST (History)
8 users (show)

See Also:


Attachments

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