[all-commits] [llvm/llvm-project] a3e207: [libc][bit_test] fix -Wimplicit-int-conversion (#1...

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Wed Feb 12 08:59:25 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3e2075e5008cefc2e896f1558b46f0882321ff5
      https://github.com/llvm/llvm-project/commit/a3e2075e5008cefc2e896f1558b46f0882321ff5
  Author: Nick Desaulniers <nick.desaulniers at gmail.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M libc/src/__support/CPP/bit.h
    M libc/test/src/__support/CPP/bit_test.cpp

  Log Message:
  -----------
  [libc][bit_test] fix -Wimplicit-int-conversion (#126317)

Fixes:

    llvm-project/libc/src/__support/CPP/bit.h:235:28: error: implicit
    conversion loses integer precision: 'int' to
'cpp::enable_if_t<cpp::is_unsigned_v<unsigned short>, unsigned short>'
(aka
    'unsigned short') [-Werror,-Wimplicit-int-conversion]
      235 |   return (value << rotate) | (value >> (N - rotate));
          |   ~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
    llvm-project/libc/src/__support/CPP/bit.h:247:28: error: implicit
    conversion loses integer precision: 'int' to
'cpp::enable_if_t<cpp::is_unsigned_v<unsigned short>, unsigned short>'
(aka
    'unsigned short') [-Werror,-Wimplicit-int-conversion]
      247 |   return (value >> rotate) | (value << (N - rotate));
          |   ~~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
    llvm-project/libc/test/src/__support/CPP/bit_test.cpp:45:36: error:
implicit conversion loses integer precision: 'int' to 'unsigned char'
    [-Werror,-Wimplicit-int-conversion]
       45 |     EXPECT_FALSE(has_single_bit<T>(two_bits_value));
          |                  ~~~~~~~~~~~~~~    ^~~~~~~~~~~~~~

Via the libc-cpp-utils-tests ninja target.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list