diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-09-16 23:15:32 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-09-16 23:15:32 +0000 |
commit | 2e96511773c6a21291dfa5218eb8ba79f04b5318 (patch) | |
tree | efedbfbb0779a980f7a33d8599d8676a07959f60 /lib/Sema/JumpDiagnostics.cpp | |
parent | 87aa1250a90af9d92ad9d6b7b65610a45bf478c1 (diff) |
In Microsoft mode, warn if an indirect goto jump over a variable initialization.
Also add a test case for the non Microsoft case because such test didn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139971 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/JumpDiagnostics.cpp')
-rw-r--r-- | lib/Sema/JumpDiagnostics.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp index 565a610b8c..fcc3154ebe 100644 --- a/lib/Sema/JumpDiagnostics.cpp +++ b/lib/Sema/JumpDiagnostics.cpp @@ -485,7 +485,8 @@ void JumpScopeChecker::VerifyJumps() { if (IndirectGotoStmt *IGS = dyn_cast<IndirectGotoStmt>(Jump)) { LabelDecl *Target = IGS->getConstantTarget(); CheckJump(IGS, Target->getStmt(), IGS->getGotoLoc(), - diag::err_goto_into_protected_scope, 0); + diag::err_goto_into_protected_scope, + diag::warn_goto_into_protected_scope); continue; } @@ -693,7 +694,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, SmallVector<unsigned, 10> ToScopesError; SmallVector<unsigned, 10> ToScopesWarning; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) { - if (S.getLangOptions().Microsoft && + if (S.getLangOptions().Microsoft && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (Scopes[I].InDiag) |