Fix astyle and test failures.
This commit is contained in:
parent
bbac4f1faf
commit
0a588496a0
|
@ -896,8 +896,7 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
|
||||||
|
|
||||||
// calling exit function?
|
// calling exit function?
|
||||||
bool unknown = false;
|
bool unknown = false;
|
||||||
if (_tokenizer->IsScopeNoReturn(tok2, &unknown))
|
if (_tokenizer->IsScopeNoReturn(tok2, &unknown)) {
|
||||||
{
|
|
||||||
if (_settings->inconclusive && unknown)
|
if (_settings->inconclusive && unknown)
|
||||||
inconclusive = true;
|
inconclusive = true;
|
||||||
else
|
else
|
||||||
|
|
|
@ -2003,8 +2003,8 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
// 'double sharp' token concatenation
|
// 'double sharp' token concatenation
|
||||||
// TODO: pattern should be "%var%|%num% ## %var%|%num%"
|
// TODO: pattern should be "%var%|%num% ## %var%|%num%"
|
||||||
while (Token::Match(tok, "%any% ## %any%") &&
|
while (Token::Match(tok, "%any% ## %any%") &&
|
||||||
(tok->isName() || tok->isNumber()) &&
|
(tok->isName() || tok->isNumber()) &&
|
||||||
(tok->tokAt(2)->isName() || tok->tokAt(2)->isNumber())) {
|
(tok->tokAt(2)->isName() || tok->tokAt(2)->isNumber())) {
|
||||||
tok->str(tok->str() + tok->strAt(2));
|
tok->str(tok->str() + tok->strAt(2));
|
||||||
tok->deleteNext(2);
|
tok->deleteNext(2);
|
||||||
}
|
}
|
||||||
|
@ -2043,7 +2043,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
}
|
}
|
||||||
|
|
||||||
// simplify round "(" parenthesis between "[;{}] and "{"
|
// simplify round "(" parenthesis between "[;{}] and "{"
|
||||||
if (Token::Match(tok, "[;{}] ( {") &&
|
if (Token::Match(tok, "[;{}] ( {") &&
|
||||||
Token::simpleMatch(tok->linkAt(2), "} ) ;")) {
|
Token::simpleMatch(tok->linkAt(2), "} ) ;")) {
|
||||||
tok->linkAt(2)->previous()->deleteNext(2);
|
tok->linkAt(2)->previous()->deleteNext(2);
|
||||||
tok->deleteNext(2);
|
tok->deleteNext(2);
|
||||||
|
|
|
@ -1770,20 +1770,20 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\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"
|
check("int foo(int a) {\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
" return(a-1);\n"
|
" return(a-1);\n"
|
||||||
"}\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"
|
check("int foo(int a) {\n"
|
||||||
" A:"
|
" A:"
|
||||||
" return(0);\n"
|
" return(0);\n"
|
||||||
" goto A;\n"
|
" goto A;\n"
|
||||||
"}\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"
|
check("void foo(int a)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -1797,7 +1797,7 @@ private:
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" }\n"
|
" }\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"
|
check("void foo(int a)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -1821,7 +1821,7 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\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"
|
check("void foo(int a)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -1833,7 +1833,7 @@ private:
|
||||||
" a+=2;\n"
|
" a+=2;\n"
|
||||||
" }\n"
|
" }\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"
|
check("void foo(int a)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
@ -1856,19 +1856,19 @@ private:
|
||||||
" throw 0;\n"
|
" throw 0;\n"
|
||||||
" return;\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"
|
check("int foo() {\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
" return 1;\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"
|
check("int foo() {\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
" foo();\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"
|
check("int foo() {\n"
|
||||||
" if(bar)\n"
|
" if(bar)\n"
|
||||||
|
@ -1886,7 +1886,7 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
" return 124;\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"
|
check("void foo() {\n"
|
||||||
" while(bar) {\n"
|
" while(bar) {\n"
|
||||||
|
@ -1894,7 +1894,7 @@ private:
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" }\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"
|
check("int foo() {\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
|
|
Loading…
Reference in New Issue