diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-03-13 10:38:17 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-03-13 10:38:17 +0000 |
commit | c64d73cce240148ea5f38d70f1851373036e716d (patch) | |
tree | 4425a0ded31c67e03e688dddc1fac96dddebe2c2 /llvm/lib/Target | |
parent | e59746f8f823b833e902d79468d9779431744ddd (diff) | |
download | bcm5719-llvm-c64d73cce240148ea5f38d70f1851373036e716d.tar.gz bcm5719-llvm-c64d73cce240148ea5f38d70f1851373036e716d.zip |
[ELF] Fix GCC8 warnings about "fall through", NFCI
Add break statements in Object/ELF.cpp since the code should consider the
generic tags for Hexagon, MIPS, and PPC. Add a test (copied from llvm-readobj)
to show that this works correctly (earlier versions of this patch would have
asserted).
The warnings in X86ELFObjectWriter.cpp are actually false-positives since
the nested switch() handles all possible values and returns in all cases.
Make this explicit by adding llvm_unreachable's.
Differential Revision: https://reviews.llvm.org/D58837
llvm-svn: 356037
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp index 910a9fcc3c3..8b6262ec22f 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp @@ -113,6 +113,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case RT64_8: return IsPCRel ? ELF::R_X86_64_PC8 : ELF::R_X86_64_8; } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_GOT: switch (Type) { case RT64_64: @@ -124,6 +125,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case RT64_8: llvm_unreachable("Unimplemented"); } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_GOTOFF: assert(Type == RT64_64); assert(!IsPCRel); @@ -140,6 +142,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case RT64_8: llvm_unreachable("Unimplemented"); } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_DTPOFF: assert(!IsPCRel); switch (Type) { @@ -152,6 +155,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case RT64_8: llvm_unreachable("Unimplemented"); } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_SIZE: assert(!IsPCRel); switch (Type) { @@ -164,6 +168,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case RT64_8: llvm_unreachable("Unimplemented"); } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_TLSCALL: return ELF::R_X86_64_TLSDESC_CALL; case MCSymbolRefExpr::VK_TLSDESC: @@ -196,6 +201,7 @@ static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, case X86::reloc_riprel_4byte_movq_load: return ELF::R_X86_64_REX_GOTPCRELX; } + llvm_unreachable("unexpected relocation type!"); } } @@ -233,6 +239,7 @@ static unsigned getRelocType32(MCContext &Ctx, case RT32_8: return IsPCRel ? ELF::R_386_PC8 : ELF::R_386_8; } + llvm_unreachable("unexpected relocation type!"); case MCSymbolRefExpr::VK_GOT: assert(Type == RT32_32); if (IsPCRel) |