You can disable it for the entire file by adding -Wno-tautological-compare to the Clang command line (after flags such as -Wall that include warnings). The disadvantage of this method is that the warning is now disabled throughout this translation unit, and not just for Q_ASSERT(...) macro Q_ASSERT(...) .
Another, more tedious but fine-grained method is to wrap each instance of the macro that generates this warning, as follows:
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtautological-compare" Q_ASSERT(value_which_is_always_smaller_than_4 < 4) #pragma clang diagnostic pop
source share