parent
6a822f4c06
commit
a6b8339990
|
@ -165,6 +165,7 @@ private:
|
|||
TEST_CASE(checkSuspiciousSemicolon1);
|
||||
TEST_CASE(checkSuspiciousSemicolon2);
|
||||
TEST_CASE(checkSuspiciousSemicolon3);
|
||||
TEST_CASE(checkSuspiciousComparison);
|
||||
|
||||
TEST_CASE(checkInvalidFree);
|
||||
|
||||
|
@ -6698,6 +6699,19 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkSuspiciousComparison() {
|
||||
checkP("void f(int a, int b) {\n"
|
||||
" a > b;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (warning, inconclusive) Found suspicious operator '>'\n", errout.str());
|
||||
|
||||
checkP("void f() {\n" // #10607
|
||||
" for (auto p : m)\n"
|
||||
" std::vector<std::pair<std::string, std::string>> k;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkInvalidFree() {
|
||||
check("void foo(char *p) {\n"
|
||||
" char *a; a = malloc(1024);\n"
|
||||
|
|
Loading…
Reference in New Issue