Cppcheck inline suppression not working

*爱你&永不变心* 提交于 2021-01-27 14:24:00

问题


Example code:

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

Cppcheck call:

$ 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.

How can I suppress this error?


回答1:


This way:

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

It requires --inline-suppr as command line argument.



来源:https://stackoverflow.com/questions/37701104/cppcheck-inline-suppression-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!