如何使用cppcheck的内联抑制过滤器选项的C ++代码? [英] How to use cppcheck's inline suppression filter option for C++ code?

查看:1065
本文介绍了如何使用cppcheck的内联抑制过滤器选项的C ++代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Cppcheck进行我的C ++代码的静态代码分析。我知道我可以通过 - inline-suppr 命令来抑制某些警告。
然而,我找不到应该在注释中输入什么suppressed_error_id:

I would like to use Cppcheck for static code analysis of my C++ code. I learned that I can suppress some kind of warnings with --inline-suppr command. However, I can't find what "suppressed_error_id" I should put in the comment:

// cppcheck-suppress "suppressed_error_id"


推荐答案

根据cppcheck help: / p>

According to the cppcheck help:


错误ID是您希望
抑制的ID。获取
的最简单的方法是使用--xml命令行标志。
复制并粘贴
xml输出中的id字符串。

The error id is the id that you want to suppress. The easiest way to get it is to use the --xml command line flag. Copy and paste the id string from the xml output.

使用 - xml 标志的错误,然后查看生成的XML文件以查找其名称。

So run cppcheck against some code that contains the error with the --xml flag, and then look in the generated XML file to find its name.

这篇关于如何使用cppcheck的内联抑制过滤器选项的C ++代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆