[clang] Address a handful of C4146 compiler warnings where literals can be replaced with std::numeric_limits (PR #147623)
Alex Sepkowski via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 9 11:02:56 PDT 2025
================
@@ -777,7 +779,7 @@ template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
IO.mapOptional("Maximum", signedMaximum);
Space.Maximum = static_cast<unsigned>(signedMaximum);
- if (Space.Maximum != -1u)
+ if (Space.Maximum != std::numeric_limits<unsigned>::max())
----------------
alsepkow wrote:
On further consideration, I think it would be cleaner to stay consistent with using numeric_limits for all of the updates. And given that there are only a handful of UINT_MAX cases in this file I've swapped them to use numeric_limits for consistency. That would be the preferred choice if this were new code anyways.
https://github.com/llvm/llvm-project/pull/147623
More information about the cfe-commits
mailing list