[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)

via libc-commits libc-commits at lists.llvm.org
Thu May 1 07:17:14 PDT 2025


================
@@ -768,7 +768,7 @@ function(add_libc_test test_name)
 endfunction(add_libc_test)
 
 # Tests all implementations that can run on the target CPU.
-function(add_libc_multi_impl_test name suite)
+function(add_libc_multi_impl_test unit_test_only name suite)
----------------
lntue wrote:

This doesn't look right to me.  Below usage of `add_libc_multi_impl_test` are 
```
add_libc_multi_impl_test(memcmp UNIT_TEST_ONLY libc-string-tests SRCS memcmp_test.cpp)
```
so the first argument, which is `unit_test_only` will be `memcmp`.

The correct way to do this is to simply add `UNIT_TEST_ONLY` right before `SRCS` for all these calls, and leave `add_libc_multi_impl_test` unchanged:
```
add_libc_multi_impl_test(memcmp libc-string-tests UNIT_TEST_ONLY SRCS memcmp_test.cpp)
```
It is because the first 2 arguments will be set to `name` and `suite`, and the rest of the arguments are in `${ARGN}` will be passed directly to `add_libc_test`, which does understand `UNIT_TEST_ONLY`.

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


More information about the libc-commits mailing list