summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/c++11/shared_ptr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/src/c++11/shared_ptr.cc')
-rw-r--r--libstdc++-v3/src/c++11/shared_ptr.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
index 74e879e5828..ae47ca03301 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -34,8 +34,12 @@ namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
__gnu_cxx::__mutex&
get_mutex(unsigned char i)
{
- // increase alignment to put each lock on a separate cache line
- struct alignas(64) M : __gnu_cxx::__mutex { };
+#ifdef _GLIBCXX_CAN_ALIGNAS_DESTRUCTIVE_SIZE
+ // Increase alignment to put each lock on a separate cache line.
+ struct alignas(__GCC_DESTRUCTIVE_SIZE) M : __gnu_cxx::__mutex { };
+#else
+ using M = __gnu_cxx::__mutex;
+#endif
// Use a static buffer, so that the mutexes are not destructed
// before potential users (or at all)
static __attribute__ ((aligned(__alignof__(M))))