[libc-commits] [libc] [libc][stdbit] Update generated stdbit generic macros and add C tests. (PR #84670)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 9 22:54:55 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 35b784379e707423f3b4f5a2cfedabcfa6f5b47d 185b3a7f9e38842c13f3221d40732e790248f529 -- libc/test/include/stdbit_stub.h libc/test/include/stdbit_test.c libc/include/llvm-libc-macros/stdbit-macros.h libc/test/include/stdbit_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/include/llvm-libc-macros/stdbit-macros.h b/libc/include/llvm-libc-macros/stdbit-macros.h
index d1b792e115..992fbde7ab 100644
--- a/libc/include/llvm-libc-macros/stdbit-macros.h
+++ b/libc/include/llvm-libc-macros/stdbit-macros.h
@@ -197,12 +197,12 @@ inline unsigned long long stdc_bit_floor(unsigned long long x) {
 #else
 
 #define STDBIT_GENERIC_FUNC(FUNC_NAME, x)                                      \
-  _Generic((x), unsigned char                                                  \
-           : FUNC_NAME##_uc, unsigned short                                    \
-           : FUNC_NAME##_us, unsigned                                          \
-           : FUNC_NAME##_ui, unsigned long                                     \
-           : FUNC_NAME##_ul, unsigned long long                                \
-           : FUNC_NAME##_ull)(x)
+  _Generic((x),                                                                \
+      unsigned char: FUNC_NAME##_uc,                                           \
+      unsigned short: FUNC_NAME##_us,                                          \
+      unsigned: FUNC_NAME##_ui,                                                \
+      unsigned long: FUNC_NAME##_ul,                                           \
+      unsigned long long: FUNC_NAME##_ull)(x)
 
 #define stdc_leading_zeros(x) STDBIT_GENERIC_FUNC(stdc_leading_zeros, (x))
 #define stdc_leading_ones(x) STDBIT_GENERIC_FUNC(stdc_leading_ones, (x))

``````````

</details>


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


More information about the libc-commits mailing list