Suppress -Wtautological-compare warning

来源:互联网 发布:南方大数据300指数基金 编辑:程序博客网 时间:2024/06/10 18:58

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
原创粉丝点击