0
点赞
收藏
分享

微信扫一扫

Suppress -Wtautological-compare warning

天际孤狼 2023-09-06 阅读 52


https://stackoverflow.com/questions/15864461/suppress-wtautological-compare-warning

-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(...)

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
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"

//出现警告的代码

#pragma clang diagnostic pop

举报

相关推荐

0 条评论