Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346559 - [fp] undeserved "no return in function returning non-void" when using goto
Summary: [fp] undeserved "no return in function returning non-void" when using goto
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0.1   Edit
Assignee: Elena Laskavaia CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
: 347390 354433 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-19 18:42 EDT by Matt Hargett CLA
Modified: 2014-01-29 22:53 EST (History)
6 users (show)

See Also:


Attachments
fix + test (2.51 KB, patch)
2011-06-21 07:21 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 Matt Hargett CLA 2011-05-19 18:42:55 EDT
Build Identifier: 201105160958

The CERT_Write_key_to_file() method below elicits an undeserved "no return in function returning non-void" warning:

class foo
{
public:
	foo();
	virtual ~foo();

	int g();

	static int
	CERT_Write_key_to_file(void)
	{
	    int 	error_code = 0;

		error_code = g();
		if (error_code != 0) {
			goto end;
		}

	end:
		return (error_code);
	}
};

Reproducible: Always
Comment 1 Elena Laskavaia CLA 2011-06-03 22:17:22 EDT
reduced sample:
    int
    fp_goto(int a)
    {
        if (a) {
            goto end;
        }

    end:
        return (a);
    }
Comment 2 Tomasz Wesolowski CLA 2011-06-21 07:21:22 EDT
Created attachment 198323 [details]
fix + test

This solves the problem
Comment 3 Elena Laskavaia CLA 2011-06-26 14:37:16 EDT
fixed in master & 8.0 (hopefully I committed it correctly)
thanks for the patch
Comment 4 Sergey Prigogin CLA 2011-06-26 20:00:18 EDT
I don't see the change in cdt_8_0.
Comment 5 Sergey Prigogin CLA 2011-06-26 20:05:38 EDT
(In reply to comment #4)
> I don't see the change in cdt_8_0.

My bad. The change is there.
Comment 6 Andrew Gvozdev CLA 2013-08-25 04:34:34 EDT
*** Bug 347390 has been marked as a duplicate of this bug. ***
Comment 7 Marc-André Laperle CLA 2013-12-20 20:41:11 EST
*** Bug 354433 has been marked as a duplicate of this bug. ***