[clang] Address a handful of C4146 compiler warnings where literals can be replaced with std::numeric_limits (PR #147623)

Tex Riddell via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 9 11:23: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 < UINT_MAX)
----------------
tex3d wrote:

Why `UINT_MAX` here instead of `std::numeric_limits<unsigned>::max()`?  And why change the comparison from `!=` to `<` (even though they would be equivalent)?

https://github.com/llvm/llvm-project/pull/147623


More information about the cfe-commits mailing list