如何解决Cppcheck的ConfigurationNotChecked错误
我使用以下命令使用cppcheck检查了程序。
cppcheck --enable=all --inconclusive --xml-version=2 --output-file=getopt.c.txt -v getopt.c
它给了我一些ConfigurationNotChecked错误。我在网上搜索,但不知道这意味着什么。下面是一些错误。
<error id="ConfigurationNotChecked" severity="information" msg="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.">
<location file="getopt.c" line="194" column="0"/>
</error>
<error id="ConfigurationNotChecked" severity="information" msg="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.">
<location file="getopt.c" line="208" column="0"/>
</error>
<error id="ConfigurationNotChecked" severity="information" msg="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration '__STDC__=0;const' since the value of 'const' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.">
<location file="getopt.c" line="317" column="0"/>
</error>
表示使用-D进行检查。我如何在上面编写的命令中使用它。我想获取有关此错误是什么的信息。我的cppcheck命令也会给我所有可能发现的错误,或者我缺少一些参数。
解决方法
手册页对此进行了描述
-D<id>
By default Cppcheck checks all configurations. Use -D to limit the checking. When -D is used the checking is limited to the given configuration. Example: -DDEBUG=1
-D__cplusplus
,
我是Cppcheck开发人员。那太奇怪了。这听起来像是Cppcheck错误。
在这种情况下,您不应使用-D
。
理想情况下,我希望您创建一个简短的代码示例来重现该问题。也许您可以在190行附近的getopt.c中提取一些代码,看看是否仍然收到此信息消息。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。