enabled and mitigated `-Wunreachable-code` Clang warnings (#4818)

This commit is contained in:
Oliver Stöneberg 2023-02-24 21:57:44 +01:00 committed by GitHub
parent 634881db61
commit a250e6b569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -91,7 +91,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options_safe(-Wno-double-promotion)
add_compile_options_safe(-Wno-shadow-field)
add_compile_options_safe(-Wno-shadow-uncaptured-local)
add_compile_options_safe(-Wno-unreachable-code)
add_compile_options_safe(-Wno-implicit-float-conversion)
add_compile_options_safe(-Wno-switch-enum)
add_compile_options_safe(-Wno-float-conversion)

View File

@ -2857,10 +2857,8 @@ void CheckClass::checkCopyCtorAndEqOperator()
{
// This is disabled because of #8388
// The message must be clarified. How is the behaviour different?
return;
// cppcheck-suppress unreachableCode - remove when code is enabled again
if (!mSettings->severity.isEnabled(Severity::warning))
if ((true) || !mSettings->severity.isEnabled(Severity::warning))
return;
for (const Scope * scope : mSymbolDatabase->classAndStructScopes) {

View File

@ -1747,7 +1747,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
// function returning function pointer? '... ( ... %name% ( ... ))( ... ) {'
// function returning reference to array '... ( & %name% ( ... ))[ ... ] {'
// TODO: Activate this again
if (false && tok->str() == "(" && tok->strAt(1) != "*" &&
if ((false) && tok->str() == "(" && tok->strAt(1) != "*" &&
(tok->link()->previous()->str() == ")" || Token::simpleMatch(tok->link()->tokAt(-2), ") const"))) {
const Token* tok2 = tok->link()->next();
if (tok2 && tok2->str() == "(" && Token::Match(tok2->link()->next(), "{|;|const|=")) {