[libcxx-commits] [libcxx] [libc++] Use glibc random APIs for std::random_device on Linux (PR #222567)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 15 01:41:34 PDT 2026
================
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-random-device
+
+// Ensure layout of std::random_device is compatible.
+
+#include <random>
+
+#include "test_macros.h"
+
+#if defined(_LIBCPP_USING_DEV_RANDOM) || \
+ (!defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT) && (defined(__APPLE__) || defined(__GLIBC__)))
----------------
philnik777 wrote:
This should use a lit feature instead. Please check e.g. `libcpp-has-abi-bounded-unique_ptr` for how to do that.
https://github.com/llvm/llvm-project/pull/222567
More information about the libcxx-commits
mailing list