Skip to content

Commit a250e6b

Browse files
authored
enabled and mitigated -Wunreachable-code Clang warnings (#4818)
1 parent 634881d commit a250e6b

3 files changed

Lines changed: 2 additions & 5 deletions

File tree

cmake/compileroptions.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
9191
add_compile_options_safe(-Wno-double-promotion)
9292
add_compile_options_safe(-Wno-shadow-field)
9393
add_compile_options_safe(-Wno-shadow-uncaptured-local)
94-
add_compile_options_safe(-Wno-unreachable-code)
9594
add_compile_options_safe(-Wno-implicit-float-conversion)
9695
add_compile_options_safe(-Wno-switch-enum)
9796
add_compile_options_safe(-Wno-float-conversion)

lib/checkclass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,10 +2857,8 @@ void CheckClass::checkCopyCtorAndEqOperator()
28572857
{
28582858
// This is disabled because of #8388
28592859
// The message must be clarified. How is the behaviour different?
2860-
return;
2861-
28622860
// cppcheck-suppress unreachableCode - remove when code is enabled again
2863-
if (!mSettings->severity.isEnabled(Severity::warning))
2861+
if ((true) || !mSettings->severity.isEnabled(Severity::warning))
28642862
return;
28652863

28662864
for (const Scope * scope : mSymbolDatabase->classAndStructScopes) {

lib/symboldatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
17471747
// function returning function pointer? '... ( ... %name% ( ... ))( ... ) {'
17481748
// function returning reference to array '... ( & %name% ( ... ))[ ... ] {'
17491749
// TODO: Activate this again
1750-
if (false && tok->str() == "(" && tok->strAt(1) != "*" &&
1750+
if ((false) && tok->str() == "(" && tok->strAt(1) != "*" &&
17511751
(tok->link()->previous()->str() == ")" || Token::simpleMatch(tok->link()->tokAt(-2), ") const"))) {
17521752
const Token* tok2 = tok->link()->next();
17531753
if (tok2 && tok2->str() == "(" && Token::Match(tok2->link()->next(), "{|;|const|=")) {

0 commit comments

Comments
 (0)