[PATCH] D142826: [Clang] Add -Wtype-limits to -Wextra for GCC compatibility

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 2 06:09:39 PST 2023


aaron.ballman added a comment.

In D142826#4098014 <https://reviews.llvm.org/D142826#4098014>, @chapuni wrote:

> This discovers a warning in https://reviews.llvm.org/rGa68d4b11465f5b3326be1dd820f59fac275b7581
> I think its checking is valid if size_t is uint32_t (eg. -m32)
>
> Could you guys teach me what the right fix for it? I don't know canonical fixes for it.

This might be pointing out an issue with our existing `-Wtype-limits` implementation, as the way I would correct that still gets diagnosed: https://godbolt.org/z/sY9PodKbf The only time the comparison is tautological is when `size_t` has less width than `uint64_t`, but the extra test for that scenario doesn't silence the diagnostic. Even when I try really hard: https://godbolt.org/z/PbWcTYaz1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142826/new/

https://reviews.llvm.org/D142826



More information about the cfe-commits mailing list