【问题标题】:Cppcheck inline suppression not workingCppcheck 内联抑制不起作用
【发布时间】:2016-10-08 15:20:38
【问题描述】:

示例代码:

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.

如何抑制这个错误?

【问题讨论】:

    标签: cppcheck


    【解决方案1】:

    这边:

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

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

    【讨论】:

    • 或者在GUI版本中设置开关启用内联抑制。
    猜你喜欢
    • 2017-04-25
    • 1970-01-01
    • 1970-01-01
    • 2011-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多