wxwidgets.cfg: Fixed containerOutOfBounds-false negatives for wxArrayInt and wxArrayString. These containers have std::vector like implementation

This commit is contained in:
orbitcowboy 2020-05-23 09:24:01 +02:00
parent 4e2f8d5d48
commit 5142c9e9ed
2 changed files with 23 additions and 3 deletions

View File

@ -22,6 +22,8 @@
<define name="wxExit" value="exit"/>
<!-- wxVector<T> is a template class which implements most of the std::vector functions -->
<define name="wxVector" value="std::vector"/>
<define name="wxArrayString" value="std::vector &lt; wxString &gt;"/>
<define name="wxArrayInt" value="std::vector &lt; int &gt;"/>
<define name="wxColor" value="wxColour"/>
<define name="wxOVERRIDE" value="override"/>
<define name="wxEXPLICIT" value="explicit"/>
@ -9076,7 +9078,7 @@
<arg nr="1" direction="in"/>
</function>
<!-- size_t wxArrayString::Add(const wxString & str, size_t copies = 1) -->
<function name="wxArrayString::Add">
<function name="wxArrayString::Add,std::vector::Add">
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue type="size_t"/>
@ -9123,7 +9125,7 @@
<arg nr="1" direction="in"/>
</function>
<!-- size_t wxArrayInt::Add(int i, size_t copies = 1) -->
<function name="wxArrayInt::Add">
<function name="wxArrayInt::Add,std::vector::Add">
<noreturn>false</noreturn>
<leak-ignore/>
<returnValue type="size_t"/>

View File

@ -28,11 +28,29 @@
#include <wx/textctrl.h>
#include <wx/propgrid/property.h>
wxString containerOutOfBounds_wxArrayString(void)
{
wxArrayString a;
a.Add("42");
a.Clear();
// cppcheck-suppress containerOutOfBounds
return a[0];
}
int containerOutOfBounds_wxArrayInt(void)
{
wxArrayInt a;
a.Add(42);
a.Clear();
// cppcheck-suppress containerOutOfBounds
return a[0];
}
void ignoredReturnValue_wxDC_GetSize(const wxDC &dc, wxCoord *width, wxCoord *height)
{
// No warning is expected for
dc.GetSize(width, height);
// Now warning is expected for
// No warning is expected for
(void)dc.GetSize();
}