Skip to content

Commit 09f4289

Browse files
Partial fix for #12825 FN constParameterReference with container functions (#6506)
1 parent 9c40fe0 commit 09f4289

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

cfg/std.cfg

+3-3
Original file line numberDiff line numberDiff line change
@@ -6706,7 +6706,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
67066706
<arg nr="1">
67076707
<not-uninit/>
67086708
</arg>
6709-
<arg nr="2" default="0">
6709+
<arg nr="2" default="0" direction="in" indirect="0">
67106710
<not-uninit/>
67116711
</arg>
67126712
</function>
@@ -6755,10 +6755,10 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
67556755
<arg nr="1">
67566756
<not-uninit/>
67576757
</arg>
6758-
<arg nr="2" default="0">
6758+
<arg nr="2" default="0" direction="in" indirect="0">
67596759
<not-uninit/>
67606760
</arg>
6761-
<arg nr="3" default="0">
6761+
<arg nr="3" default="0" direction="in" indirect="0">
67626762
<not-uninit/>
67636763
</arg>
67646764
</function>

test/cfg/std.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -5075,3 +5075,14 @@ void constVariablePointer_push_back(std::vector<T*>& d, const std::vector<T*>& s
50755075
void constParameterReference_push_back(std::vector<std::string>& v, std::string& s) { // #12661
50765076
v.push_back(s);
50775077
}
5078+
5079+
// cppcheck-suppress constParameterReference
5080+
void constParameterReference_assign(std::vector<int>& v, int& r) {
5081+
v.assign(5, r);
5082+
}
5083+
5084+
// cppcheck-suppress constParameterReference
5085+
void constParameterReference_insert(std::list<int>& l, int& r) {
5086+
l.insert(l.end(), r);
5087+
l.insert(l.end(), 5, r);
5088+
}

0 commit comments

Comments
 (0)