summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 51b5ae91d6a..0b3e60f82a8 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5028,8 +5028,11 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
// Verify that we have no forward references left. If so, there was a goto
// or address of a label taken, but no definition of it. Label fwd
// definitions are indicated with a null substmt.
- if (L->getSubStmt() != 0)
+ if (L->getSubStmt() != 0) {
+ if (!L->isUsed())
+ Diag(L->getIdentLoc(), diag::warn_unused_label) << L->getName();
continue;
+ }
// Emit error.
Diag(L->getIdentLoc(), diag::err_undeclared_label_use) << L->getName();
OpenPOWER on IntegriCloud