[libcxx-commits] [libcxx] 3992e30 - [libc++][NFC] Mark random_device::__padding_ as [[maybe_unused]] (#206248)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 27 09:15:43 PDT 2026


Author: Nikolas Klauser
Date: 2026-06-27T18:15:38+02:00
New Revision: 3992e3027a901fcbf75f466e2240df3335aa9831

URL: https://github.com/llvm/llvm-project/commit/3992e3027a901fcbf75f466e2240df3335aa9831
DIFF: https://github.com/llvm/llvm-project/commit/3992e3027a901fcbf75f466e2240df3335aa9831.diff

LOG: [libc++][NFC] Mark random_device::__padding_ as [[maybe_unused]] (#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.

Added: 
    

Modified: 
    libcxx/include/__random/random_device.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__random/random_device.h b/libcxx/include/__random/random_device.h
index a8bb1e68e72f0..9da0b6172c9fb 100644
--- a/libcxx/include/__random/random_device.h
+++ b/libcxx/include/__random/random_device.h
@@ -28,19 +28,15 @@ 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 
diff erent representation ...
 
-  _LIBCPP_DIAGNOSTIC_POP
 #  endif
 
 public:


        


More information about the libcxx-commits mailing list