Skip to content

Commit

Permalink
Partial fix for #12825 FN constParameterReference with container func…
Browse files Browse the repository at this point in the history
…tions (#6506)
  • Loading branch information
chrchr-github authored Jun 11, 2024
1 parent 9c40fe0 commit 09f4289
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6706,7 +6706,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" default="0">
<arg nr="2" default="0" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down Expand Up @@ -6755,10 +6755,10 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" default="0">
<arg nr="2" default="0" direction="in" indirect="0">
<not-uninit/>
</arg>
<arg nr="3" default="0">
<arg nr="3" default="0" direction="in" indirect="0">
<not-uninit/>
</arg>
</function>
Expand Down
11 changes: 11 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5075,3 +5075,14 @@ void constVariablePointer_push_back(std::vector<T*>& d, const std::vector<T*>& s
void constParameterReference_push_back(std::vector<std::string>& v, std::string& s) { // #12661
v.push_back(s);
}

// cppcheck-suppress constParameterReference
void constParameterReference_assign(std::vector<int>& v, int& r) {
v.assign(5, r);
}

// cppcheck-suppress constParameterReference
void constParameterReference_insert(std::list<int>& l, int& r) {
l.insert(l.end(), r);
l.insert(l.end(), 5, r);
}

0 comments on commit 09f4289

Please sign in to comment.