Fix astyle and test failures.

This commit is contained in:
Reijo Tomperi 2011-12-28 22:05:10 +02:00
parent bbac4f1faf
commit 0a588496a0
3 changed files with 15 additions and 16 deletions

View File

@ -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

View File

@ -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"