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

Bug 346559

Summary: [fp] undeserved "no return in function returning non-void" when using goto
Product: [Tools] CDT Reporter: Matt Hargett <matt>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, eclipse.sprigogin, malaperle, nathanb, xcomart, yevshif
Version: 8.0   
Target Milestone: 8.0.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix + test cdtdoug: iplog+

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