windows.cfg: Add _countof macro configuration (#1047)

By telling cppcheck about the Microsoft Windows _countof() macro it is
now able to detect out of bounds array accesses like this:
wchar_t buf[10];
for(size_t i = 0; i <= (_countof(buf)); ++i) {
buf[i] = L'\0'; // (error) Array 'buf[10]' accessed at index 10, which
is out of bounds.
}
This commit is contained in:
Sebastian 2018-01-23 15:45:06 +01:00 committed by amai2012
parent 402807b3b0
commit d46cd46d0f
1 changed files with 1 additions and 0 deletions

View File

@ -4060,4 +4060,5 @@ HFONT CreateFont(
<define name="WINAPI" value=""/> <define name="WINAPI" value=""/>
<define name="__pragma(x)" value=""/> <define name="__pragma(x)" value=""/>
<define name="TEXT(str)" value="str"/> <define name="TEXT(str)" value="str"/>
<define name="_countof(_Array)" value="(sizeof(_Array) / sizeof(_Array[0]))"/>
</def> </def>