astyle formatting

This commit is contained in:
Daniel Marjamäki 2009-07-22 18:48:42 +02:00
parent 6fecd858e3
commit e36994f54b
1 changed files with 36 additions and 36 deletions

View File

@ -450,61 +450,61 @@ private:
{
// errors..
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" int *a = abc->a;\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" int *a = abc->a;\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference\n", errout.str());
// ok dereferencing in a condition
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" if (abc && abc->a);\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" if (abc && abc->a);\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// ok to use a linked list..
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" abc = abc->next;\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" abc = abc->next;\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// reassign struct..
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" a = abc->a;\n"
" abc = abc->next;\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" a = abc->a;\n"
" abc = abc->next;\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" a = abc->a;\n"
" f(&abc);\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" a = abc->a;\n"
" f(&abc);\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// goto..
checkNullPointer("void foo(struct ABC *abc)\n"
"{\n"
" if (!abc)\n"
" goto out;"
" a = abc->a;\n"
" return;\n"
"out:\n"
" if (!abc)\n"
" ;\n"
"}\n");
"{\n"
" if (!abc)\n"
" goto out;"
" a = abc->a;\n"
" return;\n"
"out:\n"
" if (!abc)\n"
" ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}