[cfe-dev] Question on -Wswitch-enum

David Blaikie dblaikie at gmail.com
Fri Aug 3 08:32:15 PDT 2012


On Fri, Aug 3, 2012 at 6:23 AM, David Chisnall <csdavec at swan.ac.uk> wrote:
> On 3 Aug 2012, at 12:59, Nicola Gigante wrote:
>
>> So, is this the current behaviour in clang's head, contrary to what David said in the last email?
>>
>> If this is fully intentional I can blacklist it, but I still don't understand the rationale, beyond simple
>> gcc compatibility.
>
> Sorry, I was wrong, there are two warnings:
>
> -Wswitch does what you want.
> -Wswitch-enum does the wrong thing (for GCC compatibility?).

That's correct - both of these flag names/behaviors exist in GCC & we
provide the same behavior. Clang strives to improve on the quality of
diagnostics where possible with better heuristics, code understanding
(macro awareness, etc) but in this instance the two behaviors are
clearly specified & not just an implementation-quality issue - the
issue is just that the user is using -Wswitch-enum when you want
-Wswitch.

- David

> -Weverything enables both.  -Weverything -Wno-switch-enum does what you want, I believe.
>
> David
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list