aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDecl.cpp6
-rw-r--r--test/Sema/scope-check.c1
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index b580b01bc4..9424fc685c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3157,7 +3157,6 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
assert(&getLabelMap() == &FunctionLabelMap && "Didn't pop block right?");
- bool HaveLabels = !FunctionLabelMap.empty();
// Check goto/label use.
for (llvm::DenseMap<IdentifierInfo*, LabelStmt*>::iterator
I = FunctionLabelMap.begin(), E = FunctionLabelMap.end(); I != E; ++I) {
@@ -3197,9 +3196,8 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
if (!Body) return D;
- // If we have labels, verify that goto doesn't jump into scopes illegally.
- if (HaveLabels)
- JumpScopeChecker(Body, *this);
+ // Verify that that gotos and switch cases don't jump into scopes illegally.
+ JumpScopeChecker(Body, *this);
return D;
}
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c
index 93120cdf94..b7e3a21d55 100644
--- a/test/Sema/scope-check.c
+++ b/test/Sema/scope-check.c
@@ -47,7 +47,6 @@ int test6() {
}
void test7(int x) {
-foo: // FIXME: remove
switch (x) {
case 1: ;
int a[x]; // expected-note {{jump bypasses initialization of variable length array}}