使用 cppcheck 进行多行压缩

Posted

技术标签:

【中文标题】使用 cppcheck 进行多行压缩【英文标题】:Multiline supression with cppcheck 【发布时间】:2019-08-02 11:46:24 【问题描述】:

我想在 cppcheck 中使用多行抑制。 那可能吗? 例如: 我想改变

// cppcheck-suppress unusedFunction
int fn1()
    return 42;

// cppcheck-suppress unusedFunction
int fn2()

// cppcheck-suppress unusedFunction
int fn3()

int main()

类似于:

// cppcheck-suppress-start unusedFunction
int fn1()
    return 42;

int fn2()

int fn3()

// cppcheck-suppress-end unusedFunction
int main()

【问题讨论】:

【参考方案1】:

没有;根据the manual,内联抑制没有“开始”/“结束”等效语法。

但是,还有其他设置抑制的方法;例如,如果您想在整个源文件中使用unusedFunction,您可以在抑制文件中这样说。

请参阅上述链接手册中的第 6 章。

【讨论】:

以上是关于使用 cppcheck 进行多行压缩的主要内容,如果未能解决你的问题,请参考以下文章