Skip to content

Commit

Permalink
Remove workaround for missing std::atomic_thread_fence
Browse files Browse the repository at this point in the history
Fix compilation error with gcc Linux. std::memory_order is an enum
class, not an enum, which removes implicit conversions in C++20.
Compilers that support C++20 should contain the fix for the libstdc++
bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51038), so removing
the workaround in atomicops_internals_portable.h should be fine.

Bug: 339934812
Change-Id: Ie4f6f4de26b084ff33330db7d87c7881db223a62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/5514410
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
  • Loading branch information
weijian pan authored and markmentovai committed May 15, 2024
1 parent a6607b1 commit b870d45
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions base/atomicops_internals_portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ static_assert(sizeof(*(AtomicLocation32) nullptr) == sizeof(Atomic32),
"incompatible 32-bit atomic layout");

inline void MemoryBarrier() {
#if defined(__GLIBCXX__)
// Work around libstdc++ bug 51038 where atomic_thread_fence was declared but
// not defined, leading to the linker complaining about undefined references.
__atomic_thread_fence(std::memory_order_seq_cst);
#else
std::atomic_thread_fence(std::memory_order_seq_cst);
#endif
}

inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Expand Down

0 comments on commit b870d45

Please sign in to comment.