Remove some redundant 'errout.str("")' in some checks because it's already done inside tok call.

This commit is contained in:
Edoardo Prezioso 2012-01-21 00:59:12 +01:00
parent 0415444e28
commit 2a2d01a870
2 changed files with 0 additions and 9 deletions

View File

@ -2409,7 +2409,6 @@ private:
void whileAssign2() { void whileAssign2() {
// #1909 - Internal error // #1909 - Internal error
errout.str("");
tok("void f()\n" tok("void f()\n"
"{\n" "{\n"
" int b;\n" " int b;\n"

View File

@ -459,7 +459,6 @@ private:
} }
void tokenize3() { void tokenize3() {
errout.str("");
const std::string code("void foo()\n" const std::string code("void foo()\n"
"{\n" "{\n"
" int i;\n" " int i;\n"
@ -474,7 +473,6 @@ private:
} }
void tokenize4() { void tokenize4() {
errout.str("");
const std::string code("class foo\n" const std::string code("class foo\n"
"{\n" "{\n"
"public:\n" "public:\n"
@ -535,7 +533,6 @@ private:
} }
void tokenize9() { void tokenize9() {
errout.str("");
const char code[] = "typedef void (*fp)();\n" const char code[] = "typedef void (*fp)();\n"
"typedef fp (*fpp)();\n" "typedef fp (*fpp)();\n"
"void f() {\n" "void f() {\n"
@ -625,21 +622,18 @@ private:
void wrong_syntax1() { void wrong_syntax1() {
{ {
errout.str("");
const std::string code("TR(kvmpio, PROTO(int rw), ARGS(rw), TP_(aa->rw;))"); const std::string code("TR(kvmpio, PROTO(int rw), ARGS(rw), TP_(aa->rw;))");
ASSERT_EQUALS("TR ( kvmpio , PROTO ( int rw ) , ARGS ( rw ) , TP_ ( aa . rw ; ) )", tokenizeAndStringify(code.c_str(), true)); ASSERT_EQUALS("TR ( kvmpio , PROTO ( int rw ) , ARGS ( rw ) , TP_ ( aa . rw ; ) )", tokenizeAndStringify(code.c_str(), true));
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
{ {
errout.str("");
const std::string code("struct A { template<int> struct { }; };"); const std::string code("struct A { template<int> struct { }; };");
ASSERT_EQUALS("", tokenizeAndStringify(code.c_str(), true)); ASSERT_EQUALS("", tokenizeAndStringify(code.c_str(), true));
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
} }
{ {
errout.str("");
const std::string code("enum ABC { A,B, typedef enum { C } };"); const std::string code("enum ABC { A,B, typedef enum { C } };");
tokenizeAndStringify(code.c_str(), true); tokenizeAndStringify(code.c_str(), true);
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
@ -647,7 +641,6 @@ private:
{ {
// #3314 - don't report syntax error. // #3314 - don't report syntax error.
errout.str("");
const std::string code("struct A { typedef B::C (A::*f)(); };"); const std::string code("struct A { typedef B::C (A::*f)(); };");
tokenizeAndStringify(code.c_str(), true); tokenizeAndStringify(code.c_str(), true);
ASSERT_EQUALS("[test.cpp:1]: (debug) Failed to parse 'typedef B :: C ( A :: * f ) ( ) ;'. The checking continues anyway.\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (debug) Failed to parse 'typedef B :: C ( A :: * f ) ( ) ;'. The checking continues anyway.\n", errout.str());
@ -668,7 +661,6 @@ private:
void wrong_syntax_if_macro() { void wrong_syntax_if_macro() {
// #2518 // #2518
errout.str("");
const std::string code("void f() { if MACRO(); }"); const std::string code("void f() { if MACRO(); }");
tokenizeAndStringify(code.c_str(), false); tokenizeAndStringify(code.c_str(), false);
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());