On Tue, 3 Jun 2025 at 09:23, Tomasz Kaminski <tkami...@redhat.com> wrote: > > > > > On Mon, Jun 2, 2025 at 7:28 PM Jonathan Wakely <jwak...@redhat.com> wrote: >> >> This suppresses some -Wsign-conversion warnings from Clang when >> compiling with -Wsystem-headers. >> >> libstdc++-v3/ChangeLog: >> >> * include/std/bit (__rotl, __rotr): Use static_cast for >> conversion from int to unsigned. >> --- >> >> Tested x86_64-linux. > > LGTM. >> >> >> libstdc++-v3/include/std/bit | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit >> index 5187c96182f5..02d7189f1a3d 100644 >> --- a/libstdc++-v3/include/std/bit >> +++ b/libstdc++-v3/include/std/bit >> @@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> // Variant for power of two _Nd which the compiler can >> // easily pattern match. >> constexpr unsigned __uNd = _Nd; >> - const unsigned __r = __s; >> + const unsigned __r = static_cast<unsigned>(__s); > > I would define the variable as const auto, given the cast.
Done (in both places) and pushed now, thanks. >> >> return (__x << (__r % __uNd)) | (__x >> ((-__r) % __uNd)); >> } >> const int __r = __s % _Nd; >> @@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >> // Variant for power of two _Nd which the compiler can >> // easily pattern match. >> constexpr unsigned __uNd = _Nd; >> - const unsigned __r = __s; >> + const unsigned __r = static_cast<unsigned>(__s); >> return (__x >> (__r % __uNd)) | (__x << ((-__r) % __uNd)); >> } >> const int __r = __s % _Nd; >> -- >> 2.49.0 >>