Fixed #525 (false positive: vector range checking with <)

This commit is contained in:
Daniel Marjamäki 2009-08-07 16:23:28 +02:00
parent d719606201
commit a0a4008e17
2 changed files with 6 additions and 5 deletions

View File

@ -20,8 +20,6 @@
#include "tokenize.h"
#include "token.h"
// All STL Containers
#define STL_CONTAINER_LIST "bitset|deque|list|map|multimap|multiset|priority_queue|queue|set|stack|vector|hash_map|hash_multimap|hash_set"
// Register this check class (by creating a static instance of it)
@ -378,6 +376,9 @@ void CheckStl::invalidPointerError(const Token *tok, const std::string &pointer_
void CheckStl::stlBoundries()
{
// containers (not the vector)..
static const char STL_CONTAINER_LIST[] = "bitset|deque|list|map|multimap|multiset|priority_queue|queue|set|stack|hash_map|hash_multimap|hash_set";
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
{
// Declaring iterator..

View File

@ -389,9 +389,9 @@ private:
void stlBoundries1()
{
const int STL_CONTAINER_LIST = 10;
const int STL_CONTAINER_LIST = 9;
const std::string stlCont[STL_CONTAINER_LIST] =
{"vector", "deque", "list", "set", "multiset", "map",
{"deque", "list", "set", "multiset", "map",
"multimap", "hash_map", "hash_multimap", "hash_set"
};
@ -422,7 +422,7 @@ private:
check(checkStr.c_str());
ASSERT_EQUALS("[test.cpp:5]: (error) vector range check should use != and not < since the order of the pointers isn't guaranteed\n[test.cpp:6]: (error) vector range check should use != and not < since the order of the pointers isn't guaranteed\n", errout.str());
ASSERT_EQUALS("", errout.str());
}
};