[cfe-commits] r148640 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaStmt.cpp test/Sema/switch.c test/Sema/warn-unreachable.c test/SemaCXX/gnu-case-ranges.cpp test/SemaCXX/return-n

Chandler Carruth chandlerc at google.com
Sat Jan 21 14:02:33 PST 2012


On Sat, Jan 21, 2012 at 11:43 AM, Fariborz Jahanian <fjahanian at apple.com>wrote:

> Yes, clang currently treats -Wswitch-enum same as -Wswitch. Maybe, while
> you
> are at it you can address this too. Once -Wswitch-enum is corrected, a
> "default' can no
> longer hide missing case labels.
>

I worry that fixing -Wswitch-enum will simply cause everyone to turn it
off, and only turn on -Wswitch. I certainly wouldn't be interested in the
behavior described by -Wswitch-enum. It's important to be able to write a
compact switch that wants to handle exactly two cases from an enumeration,
and default the rest. The nice thing about David's patch is that when the
default becomes unnecessary, we notice it, remove it, and start benefitting
from -Wswitch warnings. So i think David's warning is likely to be valuable
even with a fixed -Wswitch-enum, and fixing -Wswitch-enum will just make
-Wswitch-enum essentially unused. =/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120121/b3770a37/attachment.html>


More information about the cfe-commits mailing list