https://stackoverflow.com/questions/15864461/suppress-wtautological-compare-warning
You can disable it for the entire file by adding -Wno-tautological-compare to
the Clang command line (after flags such as -Wall that
turn warnings on). The disadvantage of this method is that the warning is now disabled everywhere in that translation unit, not just for the Q_ASSERT(...) macro
instances.
Another, more tedious but fine grained, method is to wrap every instance of the macro that generates this warning with the following:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
//出现警告的代码
#pragma clang diagnostic pop
本文介绍了两种在Clang编译器中禁用自返比较警告的方法:一种是在整个文件中通过命令行参数-Wno-tautological-compare来全局禁用;另一种是在特定宏实例处使用#pragma指令进行局部禁用。
5092

被折叠的 条评论
为什么被折叠?



