[llvm-commits] [llvm] r147861 - in /llvm/trunk: include/llvm/Bitcode/BitCodes.h include/llvm/Target/TargetLowering.h lib/AsmParser/LLParser.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/CodeGen/GCMetadata.cpp lib/CodeGen/LLVMTargetMachine.cpp lib/

Chandler Carruth chandlerc at google.com
Wed Jan 11 02:33:17 PST 2012


On Wed, Jan 11, 2012 at 2:25 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Chandler,
>
> > Add 'llvm_unreachable' to passify GCC's understanding of the constraints
> > of several newly un-defaulted switches. This also helps optimizers
> > (including LLVM's) recognize that every case is covered, and we should
> > assume as much.
>
> previously if you added a new value to one of these enums then you would
> get a
> compiler warning from clang, while now you now longer get a compiler
> warning
> (right?).


Nope, I've not changed the switch. David Blaikie changed all of these
switches to no longer have the default case, thereby giving us the compiler
warning.

I've added the unreachable bit after the switch entirely, preserving the
switch compiler warning, but silencing the compiler warnings about falling
off the end of the *function*.

Richard had a patch that added a default case back, but I think he fixed it
already....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120111/27e0c1e8/attachment.html>


More information about the llvm-commits mailing list