使用 cppcheck 进行多行抑制

Multiline supression with cppcheck

我想在 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(){
}

没有;根据 the manual,内联抑制没有 "begin"/"end" 等效语法。

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

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