On Mon, Jan 28, 2013 at 5:11 PM, Tom Gall <tom.g...@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.
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to