Cppcheck内联抑制不起作用

时间:2016-06-08 11:23:07

标签: cppcheck

示例代码:

class Foo {
    // cppcheck-suppress noExplicitConstructor
    Foo(int foo) { }
}

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.

如何抑制此错误?

1 个答案:

答案 0 :(得分:2)

这样:

class Foo {     
// cppcheck-suppress  noExplicitConstructor     
 Foo(int foo) { } 
}; 

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

相关问题