Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 13b5a61

Browse files
committedNov 1, 2018
Fix clang -Wimplicit-fallthrough warnings across llvm, NFC
This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@345882 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent bb7d582 commit 13b5a61

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
 

‎lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class ArchHandler_x86_64 : public ArchHandler {
8080
switch (ref->kindValue()) {
8181
case ripRel32Got:
8282
assert(targetNowGOT && "target must be GOT");
83+
LLVM_FALLTHROUGH;
8384
case ripRel32GotLoad:
8485
const_cast<Reference *>(ref)
8586
->setKindValue(targetNowGOT ? ripRel32 : ripRel32GotLoadNowLea);

‎lib/ReaderWriter/MachO/MachOLinkingContext.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ void MachOLinkingContext::configure(HeaderFileType type, Arch arch, OS os,
262262
case llvm::MachO::MH_OBJECT:
263263
_printRemainingUndefines = false;
264264
_allowRemainingUndefines = true;
265+
break;
265266
default:
266267
break;
267268
}

0 commit comments

Comments
 (0)
This repository has been archived.