[Piglit] [PATCH 1/3] android: piglit-vbo.cpp compile error

Matt Turner mattst88 at gmail.com
Mon Jan 28 17:18:04 PST 2013


On Mon, Jan 28, 2013 at 5:11 PM, Tom Gall <tom.gall at linaro.org> wrote:
> Sure, but tell that to the compiler.
>
> It is bad form to not have a return at the end of a function which is
> supposed to return something.  The other way perhaps is just knock out
> the default case and return that. Either way.

% cat t.cpp
#include <assert.h>

int f(int n) {
	switch (n) {
	case 1:
		return 1;
	default:
		assert(!"FAIL");
	}
}

% gcc -O2 -Wall -pedantic -Wreturn-type -Wno-return-type -c t.cpp

<no output>

What flags do I have to use to get an error or warning? I tried with
an without optimization, C and C++, and gcc versions 4.5.4, 4.6.3, and
4.7.2.


More information about the Piglit mailing list