[libcxx-commits] [PATCH] D131999: [libcxx] Resolve warnings for Wshift-sign-overflow

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 17 08:55:00 PDT 2022


philnik added inline comments.


================
Comment at: libcxx/include/__chrono/duration.h:215
         static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
-        static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
+        static const intmax_t max = numeric_limits<intmax_t>::max();
 
----------------
Mordante wrote:
> philnik wrote:
> > That's a very complex way to write `numeric_limits<intmax_t>::max()`.
> This is a private field is there a reason not to use an __ugly name?
> @philnik shouldn't clang-tidy have spotted this?
I think clang-tidy currently only checks parameters and private non-static members. I'm sure there is a configuration for `readability-identifier-naming` for this case. I'll check that when the simpler cases are checked. (BTW `readability-` is a complete misnomer for our purposes).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131999



More information about the libcxx-commits mailing list