From 0a588496a0562b809121c978899021c33a1cac9e Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Wed, 28 Dec 2011 22:05:10 +0200 Subject: [PATCH] Fix astyle and test failures. --- lib/checknullpointer.cpp | 3 +-- lib/tokenize.cpp | 6 +++--- test/testother.cpp | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index 051e1f3d6..6003c36cd 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -896,8 +896,7 @@ void CheckNullPointer::nullPointerByCheckAndDeRef() // calling exit function? bool unknown = false; - if (_tokenizer->IsScopeNoReturn(tok2, &unknown)) - { + if (_tokenizer->IsScopeNoReturn(tok2, &unknown)) { if (_settings->inconclusive && unknown) inconclusive = true; else diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index efcc2d3f0..b0181db11 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2003,8 +2003,8 @@ bool Tokenizer::tokenize(std::istream &code, // 'double sharp' token concatenation // TODO: pattern should be "%var%|%num% ## %var%|%num%" while (Token::Match(tok, "%any% ## %any%") && - (tok->isName() || tok->isNumber()) && - (tok->tokAt(2)->isName() || tok->tokAt(2)->isNumber())) { + (tok->isName() || tok->isNumber()) && + (tok->tokAt(2)->isName() || tok->tokAt(2)->isNumber())) { tok->str(tok->str() + tok->strAt(2)); tok->deleteNext(2); } @@ -2043,7 +2043,7 @@ bool Tokenizer::tokenize(std::istream &code, } // simplify round "(" parenthesis between "[;{}] and "{" - if (Token::Match(tok, "[;{}] ( {") && + if (Token::Match(tok, "[;{}] ( {") && Token::simpleMatch(tok->linkAt(2), "} ) ;")) { tok->linkAt(2)->previous()->deleteNext(2); tok->deleteNext(2); diff --git a/test/testother.cpp b/test/testother.cpp index 89c5f9299..45458c703 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1770,20 +1770,20 @@ private: " }\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:5]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("int foo(int a) {\n" " return 0;\n" " return(a-1);\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("int foo(int a) {\n" " A:" " return(0);\n" " goto A;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("void foo(int a)\n" "{\n" @@ -1797,7 +1797,7 @@ private: " break;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:7]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:7]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("void foo(int a)\n" "{\n" @@ -1821,7 +1821,7 @@ private: " }\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:6]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("void foo(int a)\n" "{\n" @@ -1833,7 +1833,7 @@ private: " a+=2;\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:6]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:6]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("void foo(int a)\n" "{\n" @@ -1856,19 +1856,19 @@ private: " throw 0;\n" " return;\n" "}"); - ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("int foo() {\n" " return 0;\n" " return 1;\n" "}"); - ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("int foo() {\n" " return 0;\n" " foo();\n" "}"); - ASSERT_EQUALS("[test.cpp:3]: (style) Statements following return, break, continue, goto or throw will never be executed\n", errout.str()); + ASSERT_EQUALS("[test.cpp:3]: (style) Statements following return, break, continue, goto or throw will never be executed.\n", errout.str()); check("int foo() {\n" " if(bar)\n" @@ -1886,7 +1886,7 @@ private: " }\n" " return 124;\n" "}"); - ASSERT_EQUALS("[test.cpp:4]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("void foo() {\n" " while(bar) {\n" @@ -1894,7 +1894,7 @@ private: " break;\n" " }\n" "}"); - ASSERT_EQUALS("[test.cpp:4]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.\n", errout.str()); check("int foo() {\n" " return 0;\n"