[lld] r302666 - [ELF] - Use LLVM_FALLTHROUGH in code.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 07:20:00 PDT 2017


Author: grimar
Date: Wed May 10 09:19:59 2017
New Revision: 302666

URL: http://llvm.org/viewvc/llvm-project?rev=302666&view=rev
Log:
[ELF] - Use LLVM_FALLTHROUGH in code.

When compiling LLD using GCC 7 it reports warnings like:
"warning: this statement may fall through [-Wimplicit-fallthrough=]"

LLVM has LLVM_FALLTHROUGH macro which can be used to avoid such warnings.
Together with D33036 this patch fixes them.

Differential revision: https://reviews.llvm.org/D32907

Modified:
    lld/trunk/ELF/Target.cpp

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=302666&r1=302665&r2=302666&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed May 10 09:19:59 2017
@@ -1874,7 +1874,8 @@ void ARMTargetInfo::relocateOne(uint8_t
       // BLX (always unconditional) instruction to an ARM Target, select an
       // unconditional BL.
       write32le(Loc, 0xeb000000 | (read32le(Loc) & 0x00ffffff));
-  // fall through as BL encoding is shared with B
+    // fall through as BL encoding is shared with B
+    LLVM_FALLTHROUGH;
   case R_ARM_JUMP24:
   case R_ARM_PC24:
   case R_ARM_PLT32:
@@ -1908,7 +1909,8 @@ void ARMTargetInfo::relocateOne(uint8_t
     }
     // Bit 12 is 0 for BLX, 1 for BL
     write16le(Loc + 2, (read16le(Loc + 2) & ~0x1000) | (Val & 1) << 12);
-  // Fall through as rest of encoding is the same as B.W
+    // Fall through as rest of encoding is the same as B.W
+    LLVM_FALLTHROUGH;
   case R_ARM_THM_JUMP24:
     // Encoding B  T4, BL T1, BLX T2: Val = S:I1:I2:imm10:imm11:0
     // FIXME: Use of I1 and I2 require v6T2ops




More information about the llvm-commits mailing list