[libcxx-commits] [libcxx] [libc++][NFC] Mark random_device::__padding_ as [[maybe_unused]] (PR #206248)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 27 06:19:47 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/206248
Instead of pushing and popping warnings we can just mark the offending member as `[[maybe_unused]]`, improving compile times a bit and simplifying the code.
>From f3c6dbbefdac1abd90666663ab5b6b138386ddc5 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Sat, 27 Jun 2026 15:18:49 +0200
Subject: [PATCH] [libc++][NFC] Mark random_device::__padding_ as
[[maybe_unused]]
---
libcxx/include/__cxx03/__random/random_device.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libcxx/include/__cxx03/__random/random_device.h b/libcxx/include/__cxx03/__random/random_device.h
index f898c072b023e..5ce42bcc8ca1a 100644
--- a/libcxx/include/__cxx03/__random/random_device.h
+++ b/libcxx/include/__cxx03/__random/random_device.h
@@ -27,14 +27,11 @@ class _LIBCPP_EXPORTED_FROM_ABI random_device {
# ifdef _LIBCPP_USING_DEV_RANDOM
int __f_;
# elif !defined(_LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT)
- _LIBCPP_DIAGNOSTIC_PUSH
- _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field")
-
// Apple platforms used to use the `_LIBCPP_USING_DEV_RANDOM` code path, and now
// use `arc4random()` as of this comment. In order to avoid breaking the ABI, we
// retain the same layout as before.
# if defined(__APPLE__)
- int __padding_; // padding to fake the `__f_` field above
+ [[__maybe_unused__]] int __padding_; // padding to fake the `__f_` field above
# endif
// ... vendors can add workarounds here if they switch to a different representation ...
More information about the libcxx-commits
mailing list