[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/CodeGen/MachineInstr.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/CodeGen/Spiller.cpp lib/MC/MCExpr.cpp lib/Support/APFloat.cpp lib/Target/TargetLoweringObjectFile.cpp lib/VMCore/Verifier.cpp

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Wed Jan 11 20:16:42 PST 2012


On 11/01/12 05:25 AM, Duncan Sands 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?).  In short you changed from detecting a problem at compile time to
> detecting a problem at run time...  Not good!

I think we still get the warning. At least clang warns on this reduced case:

#include <stdlib.h>
enum foo {
  foo_a, foo_b
};

int f(enum foo x) {
  switch (x) {
  case foo_a:
    return 42;
  }
  abort();
}


> Ciao, Duncan.
>

Cheers,
Rafael




More information about the llvm-commits mailing list