replaced tabs with spaces
This commit is contained in:
parent
67e40a85e5
commit
3032ded9aa
|
@ -124,7 +124,7 @@ private:
|
||||||
TEST_CASE(array_index_for_continue); // for,continue
|
TEST_CASE(array_index_for_continue); // for,continue
|
||||||
TEST_CASE(array_index_for); // FN: for,if
|
TEST_CASE(array_index_for); // FN: for,if
|
||||||
TEST_CASE(array_index_for_neq); // #2211: Using != in condition
|
TEST_CASE(array_index_for_neq); // #2211: Using != in condition
|
||||||
TEST_CASE(array_index_for_question); // #2561: for, ?:
|
TEST_CASE(array_index_for_question); // #2561: for, ?:
|
||||||
TEST_CASE(array_index_for_andand_oror); // FN: using && or || in the for loop condition
|
TEST_CASE(array_index_for_andand_oror); // FN: using && or || in the for loop condition
|
||||||
TEST_CASE(array_index_vla_for); // #3221: access VLA inside for
|
TEST_CASE(array_index_vla_for); // #3221: access VLA inside for
|
||||||
TEST_CASE(array_index_extern); // FP when using 'extern'. #1684
|
TEST_CASE(array_index_extern); // FP when using 'extern'. #1684
|
||||||
|
@ -194,7 +194,7 @@ private:
|
||||||
TEST_CASE(strcat2);
|
TEST_CASE(strcat2);
|
||||||
TEST_CASE(strcat3);
|
TEST_CASE(strcat3);
|
||||||
|
|
||||||
TEST_CASE(memfunc1); // memchr/memset/memcpy
|
TEST_CASE(memfunc1); // memchr/memset/memcpy
|
||||||
TEST_CASE(memfunc2);
|
TEST_CASE(memfunc2);
|
||||||
|
|
||||||
TEST_CASE(varid1);
|
TEST_CASE(varid1);
|
||||||
|
@ -206,7 +206,7 @@ private:
|
||||||
TEST_CASE(alloc2); // Buffer allocated with malloc
|
TEST_CASE(alloc2); // Buffer allocated with malloc
|
||||||
TEST_CASE(alloc3); // statically allocated buffer
|
TEST_CASE(alloc3); // statically allocated buffer
|
||||||
TEST_CASE(alloc4); // Buffer allocated with alloca
|
TEST_CASE(alloc4); // Buffer allocated with alloca
|
||||||
TEST_CASE(malloc_memset); // using memset on buffer allocated with malloc
|
TEST_CASE(malloc_memset); // using memset on buffer allocated with malloc
|
||||||
|
|
||||||
TEST_CASE(memset1);
|
TEST_CASE(memset1);
|
||||||
TEST_CASE(memset2);
|
TEST_CASE(memset2);
|
||||||
|
@ -219,7 +219,7 @@ private:
|
||||||
TEST_CASE(terminateStrncpy3);
|
TEST_CASE(terminateStrncpy3);
|
||||||
TEST_CASE(recursive_long_time);
|
TEST_CASE(recursive_long_time);
|
||||||
|
|
||||||
TEST_CASE(crash1); // Ticket #1587 - crash
|
TEST_CASE(crash1); // Ticket #1587 - crash
|
||||||
TEST_CASE(crash2); // Ticket #2607 - crash
|
TEST_CASE(crash2); // Ticket #2607 - crash
|
||||||
TEST_CASE(crash3); // Ticket #3034 - crash
|
TEST_CASE(crash3); // Ticket #3034 - crash
|
||||||
|
|
||||||
|
@ -1400,9 +1400,9 @@ private:
|
||||||
|
|
||||||
check("int f( ) \n"
|
check("int f( ) \n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" struct {\n"
|
" struct {\n"
|
||||||
" int arr[ 3 ];\n"
|
" int arr[ 3 ];\n"
|
||||||
" } var[ 1 ];\n"
|
" } var[ 1 ];\n"
|
||||||
" int y;\n"
|
" int y;\n"
|
||||||
" var[ 0 ].arr[ 0 ] = 0;\n"
|
" var[ 0 ].arr[ 0 ] = 0;\n"
|
||||||
" var[ 0 ].arr[ 1 ] = 1;\n"
|
" var[ 0 ].arr[ 1 ] = 1;\n"
|
||||||
|
@ -1414,9 +1414,9 @@ private:
|
||||||
|
|
||||||
check("int f( ) \n"
|
check("int f( ) \n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" struct {\n"
|
" struct {\n"
|
||||||
" int arr[ 3 ];\n"
|
" int arr[ 3 ];\n"
|
||||||
" } var[ 1 ];\n"
|
" } var[ 1 ];\n"
|
||||||
" int y;\n"
|
" int y;\n"
|
||||||
" var[ 0 ].arr[ 0 ] = 0;\n"
|
" var[ 0 ].arr[ 0 ] = 0;\n"
|
||||||
" var[ 0 ].arr[ 1 ] = 1;\n"
|
" var[ 0 ].arr[ 1 ] = 1;\n"
|
||||||
|
@ -1435,17 +1435,17 @@ private:
|
||||||
" int i;\n"
|
" int i;\n"
|
||||||
" for (i = 2; --i >= 0; )\n"
|
" for (i = 2; --i >= 0; )\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" buf[i] = 1;\n"
|
" buf[i] = 1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" double buf[2];\n"
|
" double buf[2];\n"
|
||||||
" for (int i = 2; i--; )\n"
|
" for (int i = 2; i--; )\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" buf[i] = 2.;\n"
|
" buf[i] = 2.;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
@ -2417,7 +2417,7 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("void f() {\n" // ticket #2093
|
check("void f() {\n" // ticket #2093
|
||||||
" gchar x[3];\n"
|
" gchar x[3];\n"
|
||||||
" strcpy(x, \"12\");\n"
|
" strcpy(x, \"12\");\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
|
@ -254,7 +254,7 @@ private:
|
||||||
"class Z {\n"
|
"class Z {\n"
|
||||||
" char z[1];\n"
|
" char z[1];\n"
|
||||||
" Z(){\n"
|
" Z(){\n"
|
||||||
" z[0] = 0;\n"
|
" z[0] = 0;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
|
@ -486,14 +486,14 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test1() { // 3809
|
void test1() { // 3809
|
||||||
check("void f(double*&p) {\n"
|
check("void f(double*&p) {\n"
|
||||||
" p = malloc(0x100);\n"
|
" p = malloc(0x100);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test2() { // 3899
|
void test2() { // 3899
|
||||||
check("struct Fred {\n"
|
check("struct Fred {\n"
|
||||||
" char *p;\n"
|
" char *p;\n"
|
||||||
" void f1() { free(p); }\n"
|
" void f1() { free(p); }\n"
|
||||||
|
@ -501,7 +501,7 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test3() { // 3954 - reference pointer
|
void test3() { // 3954 - reference pointer
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" char *&p = x();\n"
|
" char *&p = x();\n"
|
||||||
" p = malloc(10);\n"
|
" p = malloc(10);\n"
|
||||||
|
|
|
@ -1906,8 +1906,8 @@ private:
|
||||||
" s1 = s1.substr();\n"
|
" s1 = s1.substr();\n"
|
||||||
" s2 = s1.substr(x);\n"
|
" s2 = s1.substr(x);\n"
|
||||||
" s1 = s2.substr(0, x);\n"
|
" s1 = s2.substr(0, x);\n"
|
||||||
" s1 = s2.substr(0,std::string::npos);\n"
|
" s1 = s2.substr(0,std::string::npos);\n"
|
||||||
" s1 = s2.substr(x+5-n, 0);\n"
|
" s1 = s2.substr(x+5-n, 0);\n"
|
||||||
" \n"
|
" \n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (performance) Useless call of function \'substr\' because it returns a copy of "
|
ASSERT_EQUALS("[test.cpp:5]: (performance) Useless call of function \'substr\' because it returns a copy of "
|
||||||
|
|
|
@ -933,7 +933,7 @@ private:
|
||||||
ASSERT_EQUALS(true, function->hasBody);
|
ASSERT_EQUALS(true, function->hasBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
void namespaces3() { // #3854 - namespace with unknown macro
|
void namespaces3() { // #3854 - namespace with unknown macro
|
||||||
GET_SYMBOL_DB("namespace fred UNKNOWN_MACRO(default) {\n"
|
GET_SYMBOL_DB("namespace fred UNKNOWN_MACRO(default) {\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS(2U, db->scopeList.size());
|
ASSERT_EQUALS(2U, db->scopeList.size());
|
||||||
|
|
|
@ -2481,7 +2481,7 @@ private:
|
||||||
"for ( int i = 0 ; i < 10 ; ++ i ) { }\n"
|
"for ( int i = 0 ; i < 10 ; ++ i ) { }\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
||||||
ASSERT_EQUALS("", errout.str()); // debug warnings
|
ASSERT_EQUALS("", errout.str()); // debug warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyKnownVariablesBailOutFor2() {
|
void simplifyKnownVariablesBailOutFor2() {
|
||||||
|
@ -2494,7 +2494,7 @@ private:
|
||||||
"while ( i < 10 ) { ++ i ; }\n"
|
"while ( i < 10 ) { ++ i ; }\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
||||||
ASSERT_EQUALS("", errout.str()); // debug warnings
|
ASSERT_EQUALS("", errout.str()); // debug warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyKnownVariablesBailOutFor3() {
|
void simplifyKnownVariablesBailOutFor3() {
|
||||||
|
@ -2507,7 +2507,7 @@ private:
|
||||||
"{ }\n"
|
"{ }\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
|
||||||
ASSERT_EQUALS("", errout.str()); // debug warnings
|
ASSERT_EQUALS("", errout.str()); // debug warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyKnownVariablesBailOutMemberFunction() {
|
void simplifyKnownVariablesBailOutMemberFunction() {
|
||||||
|
@ -2526,12 +2526,12 @@ private:
|
||||||
const char code[] = "int f() {\n"
|
const char code[] = "int f() {\n"
|
||||||
" int a = 0;\n"
|
" int a = 0;\n"
|
||||||
" if (x) {\n"
|
" if (x) {\n"
|
||||||
" ++a;\n" // conditional increment
|
" ++a;\n" // conditional increment
|
||||||
" }\n"
|
" }\n"
|
||||||
" return a;\n"
|
" return a;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
tokenizeAndStringify(code,true);
|
tokenizeAndStringify(code,true);
|
||||||
ASSERT_EQUALS("", errout.str()); // no debug warnings
|
ASSERT_EQUALS("", errout.str()); // no debug warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyKnownVariablesBailOutSwitchBreak() {
|
void simplifyKnownVariablesBailOutSwitchBreak() {
|
||||||
|
@ -2547,7 +2547,7 @@ private:
|
||||||
" x = p;\n"
|
" x = p;\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" case 2:\n"
|
" case 2:\n"
|
||||||
" q = x;\n" // x is not equal with p
|
" q = x;\n" // x is not equal with p
|
||||||
" x = q;\n"
|
" x = q;\n"
|
||||||
" break;\n"
|
" break;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
|
|
|
@ -33,7 +33,7 @@ private:
|
||||||
|
|
||||||
void run() {
|
void run() {
|
||||||
TEST_CASE(uninitvar1);
|
TEST_CASE(uninitvar1);
|
||||||
TEST_CASE(uninitvar_bitop); // using uninitialized operand in bit operation
|
TEST_CASE(uninitvar_bitop); // using uninitialized operand in bit operation
|
||||||
TEST_CASE(uninitvar_alloc); // data is allocated but not initialized
|
TEST_CASE(uninitvar_alloc); // data is allocated but not initialized
|
||||||
TEST_CASE(uninitvar_arrays); // arrays
|
TEST_CASE(uninitvar_arrays); // arrays
|
||||||
TEST_CASE(uninitvar_class); // class/struct
|
TEST_CASE(uninitvar_class); // class/struct
|
||||||
|
@ -262,15 +262,15 @@ private:
|
||||||
|
|
||||||
// Ticket #3597
|
// Ticket #3597
|
||||||
checkUninitVar("int f() {\n"
|
checkUninitVar("int f() {\n"
|
||||||
" int a;\n"
|
" int a;\n"
|
||||||
" int b = 1;\n"
|
" int b = 1;\n"
|
||||||
" (b += a) = 1;\n"
|
" (b += a) = 1;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: a\n","", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: a\n","", errout.str());
|
||||||
|
|
||||||
checkUninitVar("int f() {\n"
|
checkUninitVar("int f() {\n"
|
||||||
" int a,b,c;\n"
|
" int a,b,c;\n"
|
||||||
" a = b = c;\n"
|
" a = b = c;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: c\n", "", errout.str());
|
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: c\n", "", errout.str());
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ private:
|
||||||
checkUninitVar("MachineLoopRange *MachineLoopRanges::getLoopRange(const MachineLoop *Loop) {\n"
|
checkUninitVar("MachineLoopRange *MachineLoopRanges::getLoopRange(const MachineLoop *Loop) {\n"
|
||||||
" MachineLoopRange *&Range = Cache[Loop];\n"
|
" MachineLoopRange *&Range = Cache[Loop];\n"
|
||||||
" if (!Range)\n"
|
" if (!Range)\n"
|
||||||
" Range = new MachineLoopRange(Loop, Allocator, *Indexes);\n"
|
" Range = new MachineLoopRange(Loop, Allocator, *Indexes);\n"
|
||||||
" return Range;\n"
|
" return Range;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
@ -581,14 +581,14 @@ private:
|
||||||
checkUninitVar("namespace std _GLIBCXX_VISIBILITY(default)\n"
|
checkUninitVar("namespace std _GLIBCXX_VISIBILITY(default)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
"_GLIBCXX_BEGIN_NAMESPACE_CONTAINER\n"
|
"_GLIBCXX_BEGIN_NAMESPACE_CONTAINER\n"
|
||||||
" typedef unsigned long _Bit_type;\n"
|
" typedef unsigned long _Bit_type;\n"
|
||||||
" struct _Bit_reference\n"
|
" struct _Bit_reference\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" _Bit_type * _M_p;\n"
|
" _Bit_type * _M_p;\n"
|
||||||
" _Bit_type _M_mask;\n"
|
" _Bit_type _M_mask;\n"
|
||||||
" _Bit_reference(_Bit_type * __x, _Bit_type __y)\n"
|
" _Bit_reference(_Bit_type * __x, _Bit_type __y)\n"
|
||||||
" : _M_p(__x), _M_mask(__y) { }\n"
|
" : _M_p(__x), _M_mask(__y) { }\n"
|
||||||
" };\n"
|
" };\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1620,7 @@ private:
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(int x);"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(int x);"));
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(const int &x) { }"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(const int &x) { }"));
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(int &x) { ++x; }"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(int &x) { ++x; }"));
|
||||||
ASSERT_EQUALS("rename", analyseFunctions("int rename (const char* oldname, const char* newname);")); // Ticket #914
|
ASSERT_EQUALS("rename", analyseFunctions("int rename (const char* oldname, const char* newname);")); // Ticket #914
|
||||||
ASSERT_EQUALS("rename", analyseFunctions("int rename (const char oldname[], const char newname[]);"));
|
ASSERT_EQUALS("rename", analyseFunctions("int rename (const char oldname[], const char newname[]);"));
|
||||||
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));
|
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));
|
||||||
ASSERT_EQUALS("", analyseFunctions("void foo(s x) { }"));
|
ASSERT_EQUALS("", analyseFunctions("void foo(s x) { }"));
|
||||||
|
|
Loading…
Reference in New Issue