aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-08-07 00:02:35 +0000
committerFangrui Song <i@maskray.me>2022-08-07 00:02:35 +0000
commitec04e45c0358aa47c4696e474c350b9d56e42923 (patch)
tree7ee2582a268a03df942562b0ebc6c1c8b6a32e4a
parent5deb678289df4a11d5c0786d702ad2730cd7e391 (diff)
[lld] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
With C++17 there is no Clang pedantic warning or MSVC C5051.
-rw-r--r--lld/COFF/Driver.cpp2
-rw-r--r--lld/ELF/Arch/AArch64.cpp16
-rw-r--r--lld/ELF/Arch/ARM.cpp10
-rw-r--r--lld/ELF/Arch/Mips.cpp6
-rw-r--r--lld/ELF/Arch/PPC64.cpp2
-rw-r--r--lld/ELF/InputFiles.cpp2
-rw-r--r--lld/ELF/SyntheticSections.cpp2
7 files changed, 20 insertions, 20 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 155e4ca6ee3f..fac5e2f58f58 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -232,7 +232,7 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
"import library?");
break;
}
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
default:
error(mbref.getBufferIdentifier() + ": unknown file type");
break;
diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp
index fc564ab6f15a..974830ca7023 100644
--- a/lld/ELF/Arch/AArch64.cpp
+++ b/lld/ELF/Arch/AArch64.cpp
@@ -375,7 +375,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
case R_AARCH64_TLSDESC_ADR_PAGE21:
checkInt(loc, val, 33, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_ADR_PREL_PG_HI21_NC:
write32AArch64Addr(loc, val >> 12);
break;
@@ -392,7 +392,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
// transformation by placing a R_AARCH64_JUMP26 relocation at the offset of
// the instruction we want to patch.
write32le(loc, 0x14000000);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_CALL26:
checkInt(loc, val, 28, rel);
or32le(loc, (val & 0x0FFFFFFC) >> 2);
@@ -436,19 +436,19 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
break;
case R_AARCH64_MOVW_UABS_G0:
checkUInt(loc, val, 16, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_UABS_G0_NC:
or32le(loc, (val & 0xFFFF) << 5);
break;
case R_AARCH64_MOVW_UABS_G1:
checkUInt(loc, val, 32, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_UABS_G1_NC:
or32le(loc, (val & 0xFFFF0000) >> 11);
break;
case R_AARCH64_MOVW_UABS_G2:
checkUInt(loc, val, 48, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_UABS_G2_NC:
or32le(loc, (val & 0xFFFF00000000) >> 27);
break;
@@ -459,7 +459,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
case R_AARCH64_MOVW_SABS_G0:
case R_AARCH64_TLSLE_MOVW_TPREL_G0:
checkInt(loc, val, 17, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_PREL_G0_NC:
case R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
writeSMovWImm(loc, val);
@@ -468,7 +468,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
case R_AARCH64_MOVW_SABS_G1:
case R_AARCH64_TLSLE_MOVW_TPREL_G1:
checkInt(loc, val, 33, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_PREL_G1_NC:
case R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
writeSMovWImm(loc, val >> 16);
@@ -477,7 +477,7 @@ void AArch64::relocate(uint8_t *loc, const Relocation &rel,
case R_AARCH64_MOVW_SABS_G2:
case R_AARCH64_TLSLE_MOVW_TPREL_G2:
checkInt(loc, val, 49, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_AARCH64_MOVW_PREL_G2_NC:
writeSMovWImm(loc, val >> 32);
break;
diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp
index 425c45884330..f7d4c3b8a70a 100644
--- a/lld/ELF/Arch/ARM.cpp
+++ b/lld/ELF/Arch/ARM.cpp
@@ -311,7 +311,7 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file,
// Otherwise we need to interwork if STT_FUNC Symbol has bit 0 set (Thumb).
if (s.isFunc() && expr == R_PC && (s.getVA() & 1))
return true;
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_ARM_CALL: {
uint64_t dst = (expr == R_PLT_PC) ? s.getPltVA() : s.getVA();
return !inBranchRange(type, branchAddr, dst + a);
@@ -322,7 +322,7 @@ bool ARM::needsThunk(RelExpr expr, RelType type, const InputFile *file,
// Otherwise we need to interwork if STT_FUNC Symbol has bit 0 clear (ARM).
if (expr == R_PLT_PC || (s.isFunc() && (s.getVA() & 1) == 0))
return true;
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_ARM_THM_CALL: {
uint64_t dst = (expr == R_PLT_PC) ? s.getPltVA() : s.getVA();
return !inBranchRange(type, branchAddr, dst + a);
@@ -550,7 +550,7 @@ void ARM::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
write32le(loc, 0xeb000000 | (read32le(loc) & 0x00ffffff));
// fall through as BL encoding is shared with B
}
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_ARM_JUMP24:
case R_ARM_PC24:
case R_ARM_PLT32:
@@ -617,7 +617,7 @@ void ARM::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
}
}
// Fall through as rest of encoding is the same as B.W
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_ARM_THM_JUMP24:
// Encoding B T4, BL T1, BLX T2: Val = S:I1:I2:imm10:imm11:0
checkInt(loc, val, 25, rel);
@@ -809,7 +809,7 @@ int64_t ARM::getImplicitAddend(const uint8_t *buf, RelType type) const {
((lo & 0x7ff) << 1)); // imm11:0
break;
}
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_ARM_THM_JUMP24: {
// Encoding B T4, BL T1, BLX T2: A = S:I1:I2:imm10:imm11:0
// I1 = NOT(J1 EOR S), I2 = NOT(J2 EOR S)
diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp
index 61da4a73a6fd..d5a335c65932 100644
--- a/lld/ELF/Arch/Mips.cpp
+++ b/lld/ELF/Arch/Mips.cpp
@@ -125,7 +125,7 @@ RelExpr MIPS<ELFT>::getRelExpr(RelType type, const Symbol &s,
return R_MIPS_GOT_GP_PC;
if (&s == ElfSym::mipsLocalGp)
return R_MIPS_GOT_GP;
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_MIPS_32:
case R_MIPS_64:
case R_MIPS_GOT_OFST:
@@ -164,7 +164,7 @@ RelExpr MIPS<ELFT>::getRelExpr(RelType type, const Symbol &s,
case R_MICROMIPS_GOT16:
if (s.isLocal())
return R_MIPS_GOT_LOCAL_PAGE;
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_MIPS_CALL16:
case R_MIPS_GOT_DISP:
case R_MIPS_TLS_GOTTPREL:
@@ -627,7 +627,7 @@ void MIPS<ELFT>::relocate(uint8_t *loc, const Relocation &rel,
case R_MIPS_TLS_GOTTPREL:
case R_MIPS_TLS_LDM:
checkInt(loc, val, 16, rel);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_MIPS_CALL_LO16:
case R_MIPS_GOT_LO16:
case R_MIPS_GOT_OFST:
diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index f90e89cb8d67..1b4a7bac5655 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -1349,7 +1349,7 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
// of the TLS block. Therefore, in the case of R_PPC64_DTPREL34 we first
// need to subtract that value then fallthrough to the general case.
val -= dynamicThreadPointerOffset;
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case R_PPC64_PCREL34:
case R_PPC64_GOT_PCREL34:
case R_PPC64_GOT_TLSGD_PCREL34:
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index c0961b49ff38..a2f95238b12a 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -772,7 +772,7 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
break;
case SHT_LLVM_SYMPART:
ctx->hasSympart.store(true, std::memory_order_relaxed);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
default:
this->sections[i] =
createInputSection(i, sec, check(obj.getSectionName(sec, shstrtab)));
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index ff48f085a2d7..ace70480230a 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1418,7 +1418,7 @@ DynamicSection<ELFT>::computeContents() {
r.sym->stOther & STO_AARCH64_VARIANT_PCS;
}) != in.relaPlt->relocs.end())
addInt(DT_AARCH64_VARIANT_PCS, 0);
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
default:
addInSec(DT_PLTGOT, *in.gotPlt);
break;