This code was moved from a header into the library, so is no longer
affected by compiler options used when including the headers. We can
just use std::hardware_destructive_interference_size now, and remove the
comment.

libstdc++-v3/ChangeLog:

        * src/c++20/atomic.cc (__waitable_state::_S_align): Remove.
        (__waitable_state::_M_waiters, __waitable_state::_M_ver): Use
        std::hardware_destructive_interference_size for alignment.
---

Tested x86_64-linux.

 libstdc++-v3/src/c++20/atomic.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/src/c++20/atomic.cc b/libstdc++-v3/src/c++20/atomic.cc
index 3e02f437db3c..3fbc05c2e682 100644
--- a/libstdc++-v3/src/c++20/atomic.cc
+++ b/libstdc++-v3/src/c++20/atomic.cc
@@ -289,12 +289,9 @@ namespace
   // The state used by atomic waiting and notifying functions.
   struct __waitable_state
   {
-    // Don't use std::hardware_destructive_interference_size here because we
-    // don't want the layout of library types to depend on compiler options.
-    static constexpr auto _S_align = 64;
-
     // Count of threads blocked waiting on this state.
-    alignas(_S_align) __platform_wait_t _M_waiters = 0;
+    alignas(std::hardware_destructive_interference_size)
+      __platform_wait_t _M_waiters = 0;
 
 #ifndef _GLIBCXX_HAVE_PLATFORM_WAIT
     mutex _M_mtx;
@@ -310,7 +307,8 @@ namespace
     // If we can't do a platform wait on the atomic variable itself,
     // we use this member as a proxy for the atomic variable and we
     // use this for waiting and notifying functions instead.
-    alignas(_S_align) __platform_wait_t _M_ver = 0;
+    alignas(std::hardware_destructive_interference_size)
+      __platform_wait_t _M_ver = 0;
 
 #ifndef _GLIBCXX_HAVE_PLATFORM_WAIT
     __condvar _M_cv;
-- 
2.54.0

Reply via email to