[libcxx-commits] [libcxx] [libc++] Use glibc random APIs for std::random_device on Linux (PR #222567)
QIU Chaofan via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 23 15:56:45 PDT 2026
================
@@ -11,6 +11,8 @@
// XFAIL: target={{.+}}-apple-{{.+}} && using-built-library-before-llvm-14
// UNSUPPORTED: no-random-device
+// ADDITIONAL_COMPILE_FLAGS(libcpp-using-arc4-random): -DTEST_USING_ARC4_RANDOM
+// ADDITIONAL_COMPILE_FLAGS(libcpp-using-dev-random): -DTEST_USING_DEV_RANDOM
----------------
ecnelises wrote:
This is for frozen C++03 tests. Headers for C++03 defines `_LIBCPP_USING_DEV_RANDOM`, but the library binary uses arc4random/getentropy. With lit features, the test can pick correct backend configuration.
On Linux (with glibc arc4random), discarding these changes will make `ctor.pass.cpp` fail in `check_random_device_invalid`.
> `# | t.tmp.exe: ~/llvm/llvm-main/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp:50: void check_random_device_invalid(const std::string &): Assertion 'false' failed.`
https://github.com/llvm/llvm-project/pull/222567
More information about the libcxx-commits
mailing list