Cppcheck 内联抑制不起作用

Chi*_*nke 6 cppcheck

示例代码:

class Foo {
    // cppcheck-suppress noExplicitConstructor
    Foo(int foo) { }
}
Run Code Online (Sandbox Code Playgroud)

Cppcheck 调用:

$ cppcheck.exe --enable=all foo.cpp
Checking foo.cpp...
[foo.cpp:3]: (style) Class 'Foo' has a constructor with 1 argument that is not explicit.
Run Code Online (Sandbox Code Playgroud)

我怎样才能抑制这个错误?

orb*_*boy 5

这边走:

class Foo {     
// cppcheck-suppress  noExplicitConstructor     
 Foo(int foo) { } 
}; 
Run Code Online (Sandbox Code Playgroud)

它需要--inline-suppr作为命令行参数。

  • 或者在 GUI 版本中设置开关*启用内联抑制*。 (3认同)