[libc-commits] [libc] [libc][stdbit] fix return types (PR #80337)
via libc-commits
libc-commits at lists.llvm.org
Thu Feb 1 12:46:38 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 6f32d6a4f362ad1c7f6328232a68f44a44fc2d2e 7650a6f9ba13b2e08d49750be3430ffc1ff74306 -- libc/include/llvm-libc-macros/stdbit-macros.h libc/src/stdbit/stdc_leading_ones_uc.cpp libc/src/stdbit/stdc_leading_ones_uc.h libc/src/stdbit/stdc_leading_ones_ul.cpp libc/src/stdbit/stdc_leading_ones_ul.h libc/src/stdbit/stdc_leading_ones_ull.cpp libc/src/stdbit/stdc_leading_ones_ull.h libc/src/stdbit/stdc_leading_ones_us.cpp libc/src/stdbit/stdc_leading_ones_us.h libc/src/stdbit/stdc_leading_zeros_uc.cpp libc/src/stdbit/stdc_leading_zeros_uc.h libc/src/stdbit/stdc_leading_zeros_ul.cpp libc/src/stdbit/stdc_leading_zeros_ul.h libc/src/stdbit/stdc_leading_zeros_ull.cpp libc/src/stdbit/stdc_leading_zeros_ull.h libc/src/stdbit/stdc_leading_zeros_us.cpp libc/src/stdbit/stdc_leading_zeros_us.h libc/test/include/stdbit_test.cpp libc/test/src/stdbit/stdc_leading_ones_uc_test.cpp libc/test/src/stdbit/stdc_leading_ones_ui_test.cpp libc/test/src/stdbit/stdc_leading_ones_ul_test.cpp libc/test/src/stdbit/stdc_leading_ones_ull_test.cpp libc/test/src/stdbit/stdc_leading_ones_us_test.cpp libc/test/src/stdbit/stdc_leading_zeros_uc_test.cpp libc/test/src/stdbit/stdc_leading_zeros_ul_test.cpp libc/test/src/stdbit/stdc_leading_zeros_ull_test.cpp libc/test/src/stdbit/stdc_leading_zeros_us_test.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/stdbit/stdc_leading_zeros_ull.cpp b/libc/src/stdbit/stdc_leading_zeros_ull.cpp
index 115f3c3fb0..b23cea7c3e 100644
--- a/libc/src/stdbit/stdc_leading_zeros_ull.cpp
+++ b/libc/src/stdbit/stdc_leading_zeros_ull.cpp
@@ -13,7 +13,8 @@
namespace LIBC_NAMESPACE {
-LLVM_LIBC_FUNCTION(unsigned, stdc_leading_zeros_ull, (unsigned long long value)) {
+LLVM_LIBC_FUNCTION(unsigned, stdc_leading_zeros_ull,
+ (unsigned long long value)) {
return static_cast<unsigned>(cpp::countl_zero(value));
}
diff --git a/libc/test/include/stdbit_test.cpp b/libc/test/include/stdbit_test.cpp
index 26a1be05c6..6e48b0f2f7 100644
--- a/libc/test/include/stdbit_test.cpp
+++ b/libc/test/include/stdbit_test.cpp
@@ -27,14 +27,12 @@ unsigned stdc_leading_zeros_uc(unsigned char) noexcept { return 0xAAU; }
unsigned stdc_leading_zeros_us(unsigned short) noexcept { return 0xABU; }
unsigned stdc_leading_zeros_ui(unsigned) noexcept { return 0xACU; }
unsigned stdc_leading_zeros_ul(unsigned long) noexcept { return 0xADU; }
-unsigned stdc_leading_zeros_ull(unsigned long long) noexcept { return 0xAFU;
-}
+unsigned stdc_leading_zeros_ull(unsigned long long) noexcept { return 0xAFU; }
unsigned stdc_leading_ones_uc(unsigned char) noexcept { return 0xBAU; }
unsigned stdc_leading_ones_us(unsigned short) noexcept { return 0xBBU; }
unsigned stdc_leading_ones_ui(unsigned) noexcept { return 0xBCU; }
unsigned stdc_leading_ones_ul(unsigned long) noexcept { return 0xBDU; }
-unsigned stdc_leading_ones_ull(unsigned long long) noexcept { return 0xBFU;
-}
+unsigned stdc_leading_ones_ull(unsigned long long) noexcept { return 0xBFU; }
}
#include "include/llvm-libc-macros/stdbit-macros.h"
diff --git a/libc/test/src/stdbit/stdc_leading_ones_uc_test.cpp b/libc/test/src/stdbit/stdc_leading_ones_uc_test.cpp
index d0422e9fef..5d32d92e32 100644
--- a/libc/test/src/stdbit/stdc_leading_ones_uc_test.cpp
+++ b/libc/test/src/stdbit/stdc_leading_ones_uc_test.cpp
@@ -11,10 +11,12 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStdcLeadingOnesUcTest, All) {
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_uc(UCHAR_MAX), static_cast<unsigned>(UCHAR_WIDTH));
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_uc(UCHAR_MAX),
+ static_cast<unsigned>(UCHAR_WIDTH));
}
TEST(LlvmLibcStdcLeadingOnesUcTest, ZeroHot) {
for (unsigned i = 0U; i != UCHAR_WIDTH; ++i)
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_uc(~(1U << i)), UCHAR_WIDTH - i - 1U);
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_uc(~(1U << i)),
+ UCHAR_WIDTH - i - 1U);
}
diff --git a/libc/test/src/stdbit/stdc_leading_ones_ui_test.cpp b/libc/test/src/stdbit/stdc_leading_ones_ui_test.cpp
index 062f11cf66..175a48b0d3 100644
--- a/libc/test/src/stdbit/stdc_leading_ones_ui_test.cpp
+++ b/libc/test/src/stdbit/stdc_leading_ones_ui_test.cpp
@@ -11,10 +11,12 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStdcLeadingOnesUiTest, All) {
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ui(UINT_MAX), static_cast<unsigned>(UINT_WIDTH));
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ui(UINT_MAX),
+ static_cast<unsigned>(UINT_WIDTH));
}
TEST(LlvmLibcStdcLeadingOnesUiTest, ZeroHot) {
for (unsigned i = 0U; i != UINT_WIDTH; ++i)
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ui(~(1U << i)), UINT_WIDTH - i - 1U);
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ui(~(1U << i)),
+ UINT_WIDTH - i - 1U);
}
diff --git a/libc/test/src/stdbit/stdc_leading_ones_ul_test.cpp b/libc/test/src/stdbit/stdc_leading_ones_ul_test.cpp
index 810afb0e71..b216f4c28a 100644
--- a/libc/test/src/stdbit/stdc_leading_ones_ul_test.cpp
+++ b/libc/test/src/stdbit/stdc_leading_ones_ul_test.cpp
@@ -11,10 +11,12 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStdcLeadingOnesUlTest, All) {
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ul(ULONG_MAX), static_cast<unsigned>(ULONG_WIDTH));
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ul(ULONG_MAX),
+ static_cast<unsigned>(ULONG_WIDTH));
}
TEST(LlvmLibcStdcLeadingOnesUlTest, ZeroHot) {
for (unsigned i = 0U; i != ULONG_WIDTH; ++i)
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ul(~(1UL << i)), ULONG_WIDTH - i - 1U);
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ul(~(1UL << i)),
+ ULONG_WIDTH - i - 1U);
}
diff --git a/libc/test/src/stdbit/stdc_leading_ones_ull_test.cpp b/libc/test/src/stdbit/stdc_leading_ones_ull_test.cpp
index 9961af55c2..176376665b 100644
--- a/libc/test/src/stdbit/stdc_leading_ones_ull_test.cpp
+++ b/libc/test/src/stdbit/stdc_leading_ones_ull_test.cpp
@@ -11,10 +11,12 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStdcLeadingOnesUllTest, All) {
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ull(ULLONG_MAX), static_cast<unsigned>(ULLONG_WIDTH));
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ull(ULLONG_MAX),
+ static_cast<unsigned>(ULLONG_WIDTH));
}
TEST(LlvmLibcStdcLeadingOnesUllTest, ZeroHot) {
for (unsigned i = 0U; i != ULLONG_WIDTH; ++i)
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ull(~(1ULL << i)), ULLONG_WIDTH - i - 1U);
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_ones_ull(~(1ULL << i)),
+ ULLONG_WIDTH - i - 1U);
}
diff --git a/libc/test/src/stdbit/stdc_leading_zeros_uc_test.cpp b/libc/test/src/stdbit/stdc_leading_zeros_uc_test.cpp
index c454d3a90f..3d55507292 100644
--- a/libc/test/src/stdbit/stdc_leading_zeros_uc_test.cpp
+++ b/libc/test/src/stdbit/stdc_leading_zeros_uc_test.cpp
@@ -11,7 +11,8 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcStdcLeadingZerosUcTest, Zero) {
- EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_zeros_uc(0U), static_cast<unsigned>(UCHAR_WIDTH));
+ EXPECT_EQ(LIBC_NAMESPACE::stdc_leading_zeros_uc(0U),
+ static_cast<unsigned>(UCHAR_WIDTH));
}
TEST(LlvmLibcStdcLeadingZerosUcTest, OneHot) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/80337
More information about the libc-commits
mailing list