Skip to content

Commit 6c13994

Browse files
committed
mitigated readability-redundant-parentheses
1 parent 9827d71 commit 6c13994

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

cli/signalhandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
239239
}
240240
fprintf(output, " (at 0x%lx).%s\n",
241241
reinterpret_cast<unsigned long>(info->si_addr),
242-
(isAddressOnStack)?" Stackoverflow?":"");
242+
isAddressOnStack ? " Stackoverflow?" : "");
243243
break;
244244
case SIGINT:
245245
unexpectedSignal=false; // legal usage: interrupt application via CTRL-C
@@ -265,7 +265,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
265265
(type==-1)? "" :
266266
(type==0) ? "reading " : "writing ",
267267
reinterpret_cast<unsigned long>(info->si_addr),
268-
(isAddressOnStack)?" Stackoverflow?":""
268+
isAddressOnStack ? " Stackoverflow?" : ""
269269
);
270270
break;
271271
case SIGUSR1:

lib/checkautovariables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void CheckAutoVariables::autoVariables()
306306
for (const ValueFlow::Value &v : tok->values()) {
307307
if (v.isImpossible())
308308
continue;
309-
if ((v.isTokValue() && (isArrayVar(v.tokvalue) || ((v.tokvalue->tokType() == Token::eString)))) ||
309+
if ((v.isTokValue() && (isArrayVar(v.tokvalue) || (v.tokvalue->tokType() == Token::eString))) ||
310310
(v.isLocalLifetimeValue() && v.lifetimeKind == ValueFlow::Value::LifetimeKind::Address && !Token::simpleMatch(v.tokvalue, "("))) {
311311
errorInvalidDeallocation(tok, &v);
312312
break;

lib/checkclass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,10 +3183,10 @@ enum class CtorType : std::uint8_t {
31833183

31843184
void CheckClass::checkCopyCtorAndEqOperator()
31853185
{
3186-
// This is disabled because of #8388
3186+
// TODO: This is disabled because of #8388
31873187
// The message must be clarified. How is the behaviour different?
31883188
// cppcheck-suppress unreachableCode - remove when code is enabled again
3189-
if ((true) || !mSettings->severity.isEnabled(Severity::warning)) // NOLINT(readability-simplify-boolean-expr)
3189+
if ((true) || !mSettings->severity.isEnabled(Severity::warning)) // NOLINT(readability-simplify-boolean-expr,readability-redundant-parentheses)
31903190
return;
31913191

31923192
// logChecker

lib/checkmemoryleak.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void CheckMemoryLeakInFunction::checkReallocUsage()
454454
continue;
455455

456456
const AllocType allocType = getReallocationType(reallocTok, tok->varId());
457-
if (!((allocType == Malloc || allocType == OtherMem)))
457+
if (!(allocType == Malloc || allocType == OtherMem))
458458
continue;
459459
const Token* arg = getArguments(reallocTok).at(f->reallocArg - 1);
460460
while (arg && arg->isCast())

lib/checkother.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,8 +1468,8 @@ void CheckOther::variableScopeError(const Token *tok, const std::string &varname
14681468
//---------------------------------------------------------------------------
14691469
void CheckOther::checkCommaSeparatedReturn()
14701470
{
1471-
// This is experimental for now. See #5076
1472-
if ((true) || !mSettings->severity.isEnabled(Severity::style)) // NOLINT(readability-simplify-boolean-expr)
1471+
// TODO: This is experimental for now. See #5076
1472+
if ((true) || !mSettings->severity.isEnabled(Severity::style)) // NOLINT(readability-simplify-boolean-expr,readability-redundant-parentheses)
14731473
return;
14741474

14751475
// logChecker

lib/symboldatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
19391939
// function returning function pointer? '... ( ... %name% ( ... ))( ... ) {'
19401940
// function returning reference to array '... ( & %name% ( ... ))[ ... ] {'
19411941
// TODO: Activate this again
1942-
if ((false) && tok->str() == "(" && tok->strAt(1) != "*" && // NOLINT(readability-simplify-boolean-expr)
1942+
if ((false) && tok->str() == "(" && tok->strAt(1) != "*" && // NOLINT(readability-simplify-boolean-expr,readability-redundant-parentheses)
19431943
(tok->link()->strAt(-1) == ")" || Token::simpleMatch(tok->link()->tokAt(-2), ") const"))) {
19441944
const Token* tok2 = tok->link()->next();
19451945
if (tok2 && tok2->str() == "(" && Token::Match(tok2->link()->next(), "{|;|const|=")) {

lib/templatesimplifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,9 +2854,9 @@ bool TemplateSimplifier::simplifyCalculations(Token* frontToken, const Token *ba
28542854
} else if ((((Token::Match(tok->previous(), "[=[(,] 0 * %name%|%num% ,|]|)|;|=|%cop%") ||
28552855
Token::Match(tok->previous(), "return|case 0 *|&& %name%|%num% ,|:|;|=|%cop%")) &&
28562856
validTokenEnd(bounded, tok, backToken, 3)) ||
2857-
(((Token::Match(tok->previous(), "[=[(,] 0 * (") ||
2857+
((Token::Match(tok->previous(), "[=[(,] 0 * (") ||
28582858
Token::Match(tok->previous(), "return|case 0 *|&& (")) &&
2859-
validTokenEnd(bounded, tok, backToken, 2))))) {
2859+
validTokenEnd(bounded, tok, backToken, 2)))) {
28602860
tok->deleteNext();
28612861
if (tok->strAt(1) == "(")
28622862
eraseTokens(tok, tok->linkAt(1));

lib/tokenize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ bool Tokenizer::duplicateTypedef(Token *&tokPtr, const Token *name, const Token
195195
if (end->strAt(1) == "(")
196196
end = end->linkAt(1);
197197

198-
end = (end)?end->next():nullptr;
198+
end = end ? end->next() : nullptr;
199199
}
200200
if (end)
201201
end = end->next();
@@ -631,7 +631,7 @@ namespace {
631631
}
632632
}
633633
// TODO: handle all typedefs
634-
if ((false))
634+
if ((false)) // NOLINT(readability-redundant-parentheses)
635635
printTypedef(typedefToken, std::cout);
636636
mFail = true;
637637
}

lib/valueflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,8 +2678,8 @@ static void valueFlowLifetimeFunction(Token *tok, const TokenList &tokenlist, Er
26782678
std::vector<const Token *> args = getArguments(tok);
26792679
const std::size_t n = args.size();
26802680
if (n > 1 && Token::typeStr(args[n - 2]) == Token::typeStr(args[n - 1]) &&
2681-
(((astIsIterator(args[n - 2]) && astIsIterator(args[n - 1])) ||
2682-
(astIsPointer(args[n - 2]) && astIsPointer(args[n - 1]))))) {
2681+
((astIsIterator(args[n - 2]) && astIsIterator(args[n - 1])) ||
2682+
(astIsPointer(args[n - 2]) && astIsPointer(args[n - 1])))) {
26832683
LifetimeStore{
26842684
args.back(), "Added to container '" + memtok->str() + "'.", ValueFlow::Value::LifetimeKind::Object}
26852685
.byDerefCopy(memtok, tokenlist, errorLogger, settings);

0 commit comments

Comments
 (0)