From d8323c367ec4e9ff00f58cfbf8c41524f28feb17 Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Mon, 6 Feb 2023 22:03:23 +0100
Subject: [PATCH] std.cfg: use-retval for container member functions (#4766)
---
cfg/std.cfg | 8 ++++++--
test/cfg/std.cpp | 13 +++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/cfg/std.cfg b/cfg/std.cfg
index 05a060377..2737d69f1 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -6699,11 +6699,15 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
-
+
false
-
+
+
+ false
+
+
false
diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp
index 64788f85d..00734726a 100644
--- a/test/cfg/std.cpp
+++ b/test/cfg/std.cpp
@@ -4205,6 +4205,19 @@ void ignoredReturnValue_string_compare(std::string teststr, std::wstring testwst
testwstr.compare(L"wtest");
}
+// cppcheck-suppress constParameter
+void ignoredReturnValue_container_access(std::string& s, std::string_view& sv, std::vector& v)
+{
+ // cppcheck-suppress ignoredReturnValue
+ s.begin();
+ // cppcheck-suppress ignoredReturnValue
+ v.end();
+ // cppcheck-suppress ignoredReturnValue
+ sv.front();
+ // cppcheck-suppress ignoredReturnValue
+ s.at(0);
+}
+
void ignoredReturnValue_locale_global(const std::locale& loc)
{
// no ignoredReturnValue shall be shown for