Cppcheck使用microsoft编译器扩展

Zit*_*rax 5 c++ visual-studio cppcheck

下面的代码使用microsoft编译器扩展__try__leave:

void f()
{
  char* a = nullptr;
  __try {
    a = (char*) malloc(10);
    if(!a) __leave;
    a[1];
  } __finally {}
}
Run Code Online (Sandbox Code Playgroud)

目前上面的代码给出了以下警告:

(warning) Either the condition '!a' is redundant or there is possible null pointer dereference: a.
Run Code Online (Sandbox Code Playgroud)

所以问题似乎是cppcheck不理解__leave如果a为null则离开块.用"返回"替换它会导致警告消失.

是否有可能让cppcheck明白这一点?cppcheck手册说明:

您可以检查包含各种编译器扩展,内联汇编代码等的非标准代码.

但我没有找到任何进一步的信息.

注意,我不是在寻找更改代码以使cppcheck满意,而是让cppcheck了解现有代码.