[ELF] Fix GCC8 warnings about "fall through", NFCI
authorJonas Hahnfeld <hahnjo@hahnjo.de>
Wed, 13 Mar 2019 10:38:17 +0000 (10:38 +0000)
committerJonas Hahnfeld <hahnjo@hahnjo.de>
Wed, 13 Mar 2019 10:38:17 +0000 (10:38 +0000)
commitc64d73cce240148ea5f38d70f1851373036e716d
tree4425a0ded31c67e03e688dddc1fac96dddebe2c2
parente59746f8f823b833e902d79468d9779431744ddd
[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
llvm/lib/Object/ELF.cpp
llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
llvm/test/tools/llvm-objdump/elf-dynamic-section-machine-specific.test [new file with mode: 0644]
llvm/test/tools/llvm-readobj/Inputs/elf-dynamic-tags-machine-specific.yaml [new file with mode: 0644]
llvm/test/tools/llvm-readobj/elf-dynamic-tags-machine-specific.test