Skip to content

Commit

Permalink
Auto merge of #39063 - ruuda:covered-switch, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix covered-switch-default warnings in RustWrapper

These switch statements cover all possible values, so the default case is dead code (it contains an `llvm_unreachable anyway`), triggering a `-Wcovered-switch-default` warning that pollutes the build output. Moving the unreachable after the switch resolves these warnings.

r? @rkruppe
  • Loading branch information
bors committed Jan 15, 2017
2 parents 20ba64d + 004f18d commit c21f73e
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
return Attribute::ZExt;
case InReg:
return Attribute::InReg;
default:
llvm_unreachable("bad AttributeKind");
}
llvm_unreachable("bad AttributeKind");
}

extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned Index,
Expand Down Expand Up @@ -1233,9 +1232,8 @@ static LLVMLinkage fromRust(LLVMRustLinkage Linkage) {
return LLVMExternalWeakLinkage;
case LLVMRustLinkage::CommonLinkage:
return LLVMCommonLinkage;
default:
llvm_unreachable("Invalid LLVMRustLinkage value!");
}
llvm_unreachable("Invalid LLVMRustLinkage value!");
}

extern "C" LLVMRustLinkage LLVMRustGetLinkage(LLVMValueRef V) {
Expand Down Expand Up @@ -1282,10 +1280,8 @@ static LLVMRustVisibility toRust(LLVMVisibility Vis) {
return LLVMRustVisibility::Hidden;
case LLVMProtectedVisibility:
return LLVMRustVisibility::Protected;

default:
llvm_unreachable("Invalid LLVMRustVisibility value!");
}
llvm_unreachable("Invalid LLVMRustVisibility value!");
}

static LLVMVisibility fromRust(LLVMRustVisibility Vis) {
Expand All @@ -1296,10 +1292,8 @@ static LLVMVisibility fromRust(LLVMRustVisibility Vis) {
return LLVMHiddenVisibility;
case LLVMRustVisibility::Protected:
return LLVMProtectedVisibility;

default:
llvm_unreachable("Invalid LLVMRustVisibility value!");
}
llvm_unreachable("Invalid LLVMRustVisibility value!");
}

extern "C" LLVMRustVisibility LLVMRustGetVisibility(LLVMValueRef V) {
Expand Down

0 comments on commit c21f73e

Please sign in to comment.