Skip to content

Commit 484b68c

Browse files
committed
astyle formatting
1 parent 01df6e2 commit 484b68c

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

lib/checkunusedvar.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,8 @@ bool CheckUnusedVar::isRecordTypeWithoutSideEffects(const Type* type)
15171517
return withoutSideEffects = false;
15181518
}
15191519
const Function* initValueFunc = valueToken->function();
1520-
if (initValueFunc && !isFunctionWithoutSideEffects(*initValueFunc, valueToken,
1521-
std::list<const Function*>{})) {
1520+
if (initValueFunc && !isFunctionWithoutSideEffects(*initValueFunc, valueToken,
1521+
std::list<const Function*> {})) {
15221522
return withoutSideEffects = false;
15231523
}
15241524
}
@@ -1594,7 +1594,8 @@ bool CheckUnusedVar::isEmptyType(const Type* type)
15941594
}
15951595

15961596
bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const Token* functionUsageToken,
1597-
std::list<const Function*> checkedFuncs) {
1597+
std::list<const Function*> checkedFuncs)
1598+
{
15981599
// no body to analyze
15991600
if (!func.hasBody()) {
16001601
return false;
@@ -1608,17 +1609,16 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
16081609
}
16091610

16101611
bool sideEffectReturnFound = false;
1611-
for (Token* bodyToken = func.functionScope->bodyStart->next(); bodyToken != func.functionScope->bodyEnd;
1612-
bodyToken = bodyToken->next())
1613-
{
1612+
for (Token* bodyToken = func.functionScope->bodyStart->next(); bodyToken != func.functionScope->bodyEnd;
1613+
bodyToken = bodyToken->next()) {
16141614
const Variable* bodyVariable = bodyToken->variable();
16151615
if (bodyVariable) {
16161616
// check variable for side-effects
16171617
if (!isVariableWithoutSideEffects(*bodyVariable)) {
16181618
return false;
16191619
}
16201620
// check if global variable is changed
1621-
if (bodyVariable->isGlobal()) {
1621+
if (bodyVariable->isGlobal()) {
16221622
return false; // TODO: analyze global variable usage
16231623
}
16241624
}
@@ -1645,7 +1645,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
16451645
}
16461646
// simple one-token return
16471647
const Variable* returnVariable = returnValueToken->variable();
1648-
if (returnValueToken->isLiteral() ||
1648+
if (returnValueToken->isLiteral() ||
16491649
(returnVariable && isVariableWithoutSideEffects(*returnVariable))) {
16501650
continue;
16511651
}

lib/checkunusedvar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class CPPCHECKLIB CheckUnusedVar : public Check {
7575
bool isVariableWithoutSideEffects(const Variable& var);
7676
bool isEmptyType(const Type* type);
7777
bool isFunctionWithoutSideEffects(const Function& func, const Token* functionUsageToken,
78-
std::list<const Function*> checkedFuncs);
78+
std::list<const Function*> checkedFuncs);
7979

8080
// Error messages..
8181
void unusedStructMemberError(const Token *tok, const std::string &structname, const std::string &varname, bool isUnion = false);

test/testunusedvar.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,7 @@ class TestUnusedVar : public TestFixture {
515515
ASSERT_EQUALS("", errout.str());
516516
}
517517

518-
void cleanFunction()
519-
{
518+
void cleanFunction() {
520519
// unknown function
521520
functionVariableUsage(
522521
"class F {\n"
@@ -541,7 +540,7 @@ class TestUnusedVar : public TestFixture {
541540
" C c;\n"
542541
"}");
543542
ASSERT_EQUALS("", errout.str());
544-
543+
545544
// return literal
546545
functionVariableUsage(
547546
"int func() { return 1; }\n"

0 commit comments

Comments
 (0)