Nikita Leontiev - 18 hours ago

cppcheck 2.20.0 generates misra-c2012-2.2 false positive for the following code:

#include <windows.h>

int func(HANDLE event1, HANDLE event2)
{
    HANDLE events[] = {event1, event2};
    switch (WaitForMultipleObjects(2, events, FALSE, INFINITE))
    {
    case WAIT_OBJECT_0:
        return 1;
    case WAIT_OBJECT_0 + 1:
        return 2;
    }
    return 0;
}
cppcheck.exe --enable=all --library=windows --addon=misra.json .
test\main.cpp:10:7: style: There shall be no dead code [misra-c2012-2.2]
 case WAIT_OBJECT_0 + 1:
      ^