【问题标题】:how to disable specific warning when -Wall is enabled启用-Wall时如何禁用特定警告
【发布时间】:2011-02-06 00:35:55
【问题描述】:

我在 Makefile 中使用了-Wall -Werror,但我想禁用以下特定类型的警告:

 warning: '_wrap_delete_DMXTSFILTER' defined but not used

我应该怎么做?

【问题讨论】:

标签: linux gcc makefile compilation


【解决方案1】:

最后,我使用了这个技巧 __attribute__((unused))。优点是我可以将其应用于单个函数/变量,而不是 -Wno-unsed-xxxxx 将应用于的整个源文件。

【讨论】:

    【解决方案2】:

    假设它是未使用的变量:

    -Wno-unused-variable
    

    【讨论】:

      【解决方案3】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-27
        • 2011-09-13
        • 1970-01-01
        相关资源
        最近更新 更多