diff --git a/cfg/std.cfg b/cfg/std.cfg
index 5d3109d7e..98fc82ad4 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -3966,6 +3966,11 @@
+
+
+
+
+
@@ -3981,8 +3986,10 @@
+
+
@@ -3990,15 +3997,20 @@
+
+
-
+
+
+
+
@@ -4006,41 +4018,78 @@
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
@@ -4050,6 +4099,11 @@
+
+
+
+
+
diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp
index 3170376fa..4a7250eb4 100644
--- a/lib/checkstl.cpp
+++ b/lib/checkstl.cpp
@@ -86,7 +86,7 @@ void CheckStl::iterators()
continue;
Library::Container::Yield yield = container->getYield(containertok->strAt(2));
- if (yield != Library::Container::END_ITERATOR && yield != Library::Container::START_ITERATOR)
+ if (yield != Library::Container::END_ITERATOR && yield != Library::Container::START_ITERATOR && yield != Library::Container::ITERATOR)
continue;
} else
continue;
@@ -693,7 +693,7 @@ void CheckStl::if_find()
if (if_findCompare(funcTok->next()))
continue;
- if (printWarning && !container->stdStringLike)
+ if (printWarning && container->getYield(funcTok->str()) == Library::Container::ITERATOR)
if_findError(tok, false);
else if (printPerformance && container->stdStringLike)
if_findError(tok, true);
@@ -1405,13 +1405,14 @@ void CheckStl::readingEmptyStlContainer_parseUsage(const Token* tok, const Libra
const Token* parent = tok->tokAt(3)->astParent();
// Member function call
if (yield != Library::Container::NO_YIELD &&
- ((yield != Library::Container::START_ITERATOR &&
+ ((yield != Library::Container::ITERATOR &&
+ yield != Library::Container::START_ITERATOR &&
yield != Library::Container::END_ITERATOR) || !parent || Token::Match(parent, "%cop%|=|*"))) { // These functions read from the container
if (!noerror)
readingEmptyStlContainerError(tok);
} else {
Library::Container::Action action = container->getAction(tok->strAt(2));
- if (action == Library::Container::FIND) {
+ if (action == Library::Container::FIND || action == Library::Container::ERASE || action == Library::Container::POP || action == Library::Container::CLEAR) {
if (!noerror)
readingEmptyStlContainerError(tok);
} else
diff --git a/lib/library.cpp b/lib/library.cpp
index 7e61df1cb..2f79fd297 100644
--- a/lib/library.cpp
+++ b/lib/library.cpp
@@ -356,6 +356,16 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
action = Container::POP;
else if (actionName == "find")
action = Container::FIND;
+ else if (actionName == "insert")
+ action = Container::INSERT;
+ else if (actionName == "erase")
+ action = Container::ERASE;
+ else if (actionName == "change-content")
+ action = Container::CHANGE_CONTENT;
+ else if (actionName == "change-internal")
+ action = Container::CHANGE_INTERNAL;
+ else if (actionName == "change")
+ action = Container::CHANGE;
else
return Error(BAD_ATTRIBUTE_VALUE, actionName);
}
@@ -376,6 +386,8 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
yield = Container::START_ITERATOR;
else if (yieldName == "end-iterator")
yield = Container::END_ITERATOR;
+ else if (yieldName == "iterator")
+ yield = Container::ITERATOR;
else if (yieldName == "size")
yield = Container::SIZE;
else if (yieldName == "empty")
diff --git a/lib/library.h b/lib/library.h
index d03743a59..1e1f5c7ee 100644
--- a/lib/library.h
+++ b/lib/library.h
@@ -142,11 +142,11 @@ public:
}
enum Action {
- RESIZE, CLEAR, PUSH, POP, FIND,
+ RESIZE, CLEAR, PUSH, POP, FIND, INSERT, ERASE, CHANGE_CONTENT, CHANGE, CHANGE_INTERNAL,
NO_ACTION
};
enum Yield {
- AT_INDEX, ITEM, BUFFER, BUFFER_NT, START_ITERATOR, END_ITERATOR, SIZE, EMPTY,
+ AT_INDEX, ITEM, BUFFER, BUFFER_NT, START_ITERATOR, END_ITERATOR, ITERATOR, SIZE, EMPTY,
NO_YIELD
};
struct Function {