From e1db4c0e2c1c947df046846e93cf20b018d4f120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 21 Apr 2018 13:28:31 +0200 Subject: [PATCH] astyle formatting [ci skip] --- lib/checkother.cpp | 10 +++++----- test/testleakautovar.cpp | 14 +++++++------- test/testother.cpp | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index ed5dfc553..f1192aaef 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1974,11 +1974,11 @@ void CheckOther::checkDuplicateExpression() } duplicateExpressionError(tok, tok, tok->str()); } - } - } else if (styleEnabled && - isOppositeCond(true, _tokenizer->isCPP(), tok->astOperand1(), tok->astOperand2(), _settings->library, false) && - !Token::simpleMatch(tok, "=") && - isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand1())) { + } + } else if (styleEnabled && + isOppositeCond(true, _tokenizer->isCPP(), tok->astOperand1(), tok->astOperand2(), _settings->library, false) && + !Token::simpleMatch(tok, "=") && + isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand1())) { oppositeExpressionError(tok, tok, tok->str()); } else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative if (styleEnabled && tok->astOperand2() && tok->str() == tok->astOperand1()->str() && isSameExpression(_tokenizer->isCPP(), true, tok->astOperand2(), tok->astOperand1()->astOperand2(), _settings->library, true) && isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand2())) diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 233e5e4eb..081a739b7 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -947,13 +947,13 @@ private: } void doublefree9() { - check("struct foo {\n" - " int* get(int) { return new int(); }\n" - "};\n" - "void f(foo* b) {\n" - " std::unique_ptr x(b->get(0));\n" - " std::unique_ptr y(b->get(1));\n" - "}\n", true); + check("struct foo {\n" + " int* get(int) { return new int(); }\n" + "};\n" + "void f(foo* b) {\n" + " std::unique_ptr x(b->get(0));\n" + " std::unique_ptr y(b->get(1));\n" + "}\n", true); ASSERT_EQUALS("", errout.str()); } diff --git a/test/testother.cpp b/test/testother.cpp index 34e081073..e9de3ea36 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -3925,25 +3925,25 @@ private: check("void f(bool a) { if(a != !a) {} }"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '!='.\n", errout.str()); - + check("void f(bool a) { if( a == !(a) ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '=='.\n", errout.str()); - + check("void f(bool a) { if( a != !(a) ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '!='.\n", errout.str()); - + check("void f(bool a) { if( !(a) == a ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '=='.\n", errout.str()); - + check("void f(bool a) { if( !(a) != a ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '!='.\n", errout.str()); - + check("void f(bool a) { if( !(!a) == !(a) ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '=='.\n", errout.str()); - + check("void f(bool a) { if( !(!a) != !(a) ) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Opposite expression on both sides of '!='.\n", errout.str()); - + check("void f(bool a) { a = !a; }"); ASSERT_EQUALS("", errout.str()); }