[libc-commits] [libc] [libc][stdbit] implement stdc_trailing_ones (C23) (PR #80459)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Feb 2 09:55:13 PST 2024


================
@@ -1,112 +1,23 @@
 add_custom_target(libc-stdbit-tests)
 
-add_libc_test(
-  stdc_leading_zeros_uc_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_zeros_uc_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_zeros_uc
-)
-
-add_libc_test(
-  stdc_leading_zeros_us_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_zeros_us_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_zeros_us
-)
-
-add_libc_test(
-  stdc_leading_zeros_ui_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_zeros_ui_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_zeros_ui
-)
-
-add_libc_test(
-  stdc_leading_zeros_ul_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_zeros_ul_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_zeros_ul
-)
-
-add_libc_test(
-  stdc_leading_zeros_ull_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_zeros_ull_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_zeros_ull
-)
-
-add_libc_test(
-  stdc_leading_ones_uc_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_ones_uc_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_ones_uc
-)
-
-add_libc_test(
-  stdc_leading_ones_us_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_ones_us_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_ones_us
-)
-
-add_libc_test(
-  stdc_leading_ones_ui_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_ones_ui_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_ones_ui
-)
-
-add_libc_test(
-  stdc_leading_ones_ul_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_ones_ul_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_ones_ul
-)
-
-add_libc_test(
-  stdc_leading_ones_ull_test
-  SUITE
-    libc-stdbit-tests
-  SRCS
-    stdc_leading_ones_ull_test.cpp
-  DEPENDS
-    libc.src.__support.CPP.limits
-    libc.src.stdbit.stdc_leading_ones_ull
-)
-
+list(APPEND prefixes
+  leading_zeros
+  leading_ones
+  trailing_zeros
+  trailing_ones
+)
+list(APPEND suffixes c s i l ll)
+foreach(prefix IN LISTS prefixes)
+  foreach(suffix IN LISTS suffixes)
----------------
jhuber6 wrote:

```suggestion
foreach(prefix leading_zeros leading_ones trailing_zeros trailing_ones)
  foreach(suffix c s i l ll)
```
This should work unless we're actually depending on this appending to some list defined somewhere else.

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


More information about the libc-commits mailing list