Cppcheck的ConfigurationNotChecked错误

问题描述

我使用以下命令使用cppcheck检查了程序。

cppcheck --enable=all --inconclusive --xml-version=2 --output-file=getopt.c.txt -v getopt.c

它给了我一些ConfigurationNotChecked错误。我在网上搜索,但不知道这意味着什么。下面是一些错误

    <error id="ConfigurationNotChecked" severity="@R_333_4045@ion" msg="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; is unkNown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; 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="@R_333_4045@ion" msg="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; is unkNown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; 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="@R_333_4045@ion" msg="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; is unkNown. Use -D if you want to check it. You can use -U to skip it explicitly." verbose="Skipping configuration &apos;__STDC__=0;const&apos; since the value of &apos;const&apos; 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中提取一些代码,看看是否仍然收到此信息消息。