summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ELF.cpp
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2019-03-13 10:38:17 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2019-03-13 10:38:17 +0000
commitc64d73cce240148ea5f38d70f1851373036e716d (patch)
tree4425a0ded31c67e03e688dddc1fac96dddebe2c2 /llvm/lib/Object/ELF.cpp
parente59746f8f823b833e902d79468d9779431744ddd (diff)
downloadbcm5719-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/Object/ELF.cpp')
-rw-r--r--llvm/lib/Object/ELF.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index dd8f3a9f331..d5d98126343 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -438,6 +438,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#include "llvm/BinaryFormat/DynamicTags.def"
#undef HEXAGON_DYNAMIC_TAG
}
+ break;
case ELF::EM_MIPS:
switch (Type) {
@@ -445,6 +446,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#include "llvm/BinaryFormat/DynamicTags.def"
#undef MIPS_DYNAMIC_TAG
}
+ break;
case ELF::EM_PPC64:
switch (Type) {
@@ -452,6 +454,7 @@ std::string ELFFile<ELFT>::getDynamicTagAsString(unsigned Arch,
#include "llvm/BinaryFormat/DynamicTags.def"
#undef PPC64_DYNAMIC_TAG
}
+ break;
}
#undef DYNAMIC_TAG
switch (Type) {
OpenPOWER on IntegriCloud