r202349 - [-Wunreachable-code] Don't warn about unreachable 'default:' cases.
Justin Bogner
mail at justinbogner.com
Wed Feb 26 21:59:03 PST 2014
Ted Kremenek <kremenek at apple.com> writes:
> [-Wunreachable-code] Don't warn about unreachable 'default:' cases.
>
> They are covered by -Wcovered-switch-default.
...
> +// Don't warn about unreachable 'default' cases, as that is covered
> +// by -Wcovered-switch-default.
> +typedef enum { Value1 = 1 } MyEnum;
> +void unreachable_default(MyEnum e) {
> + switch (e) {
> + case Value1:
Some funny indentation snuck into the test case here.
> + calledFun();
> + break;
> + default:
> + calledFun(); // no-warning
> + break;
> + }
> +}
More information about the cfe-commits
mailing list