Skip to content

Commit f9e69c4

Browse files
Fix #13233 False positive unusedLabel when using __finally on Windows (danmar#6927)
1 parent b7ad05b commit f9e69c4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/checkother.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3415,7 +3415,7 @@ void CheckOther::checkUnusedLabel()
34153415

34163416
if (Token::Match(tok, "{|}|; %name% :") && !tok->tokAt(1)->isKeyword()) {
34173417
const std::string tmp("goto " + tok->strAt(1));
3418-
if (!Token::findsimplematch(scope->bodyStart->next(), tmp.c_str(), tmp.size(), scope->bodyEnd->previous()))
3418+
if (!Token::findsimplematch(scope->bodyStart->next(), tmp.c_str(), tmp.size(), scope->bodyEnd->previous()) && !tok->next()->isExpandedMacro())
34193419
unusedLabelError(tok->next(), tok->next()->scope()->type == Scope::eSwitch, hasIfdef);
34203420
}
34213421
}

test/cfg/windows.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,3 +1207,10 @@ void SEH_knownConditionTrueFalse() { // #8434
12071207
}
12081208
if (r == 0) {}
12091209
}
1210+
1211+
void SEH_unusedLabel() { // #13233
1212+
__try {
1213+
}
1214+
__finally {
1215+
}
1216+
}

0 commit comments

Comments
 (0)