Excessive use of LLVM_FALLTHROUGH?

I came across a weird-looking use of LLVM_FALLTHROUGH which I think is
completely spurious, but I figured I should check with the group mind
before ripping it out. Basically, if you have multiple cases with no
code in between, you do *not* need LLVM_FALLTHROUGH, right?

  switch (Foo) {
  case Bar1:
    LLVM_FALLTHROUGH; // not needed
  case Bar2:
    some code;
  case Bar3:
    LLVM_FALLTHROUGH; // not needed
  case Bar4:
    code without a break/return;
    LLVM_FALLTHROUGH; // <-- This one is needed.
  case Bar5:
    more code;
    llvm_unreachable("Foo with no Bar");

So, can I take out all the ones marked "not needed" as an NFC cleanup?

P.S. If you care, the specific example I tripped over is in
llvm/lib/CodeGen/AsmPrinter/DIE.cpp, DIEInteger::EmitValue().

Yep, go for it! It doesn't look like we build with -Wimplicit-fallthrough,
so all these annotations are really just for readability and future
proofing for when someone enables it.

Dug and found https://github.com/llvm-mirror/llvm/blob/88d207542b618ca6054b24491ddd67f8ca397540/include/llvm/Support/Compiler.h#L233

#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
235 #define LLVM_FALLTHROUGH [[fallthrough]]
236 #elif !__cplusplus

which is for [[fallthrough]] in

which just tells compiler not to emit warning on fall-through.

They’re all warning removers.


Aha! Trying out –Wimplicit-fallthrough, you don’t need an annotation for successive cases with no code in between.

So all of these really are just noise.