Skip to content

Commit

Permalink
[libc++] Do not specify the underlying type of memory_order
Browse files Browse the repository at this point in the history
Summary:
This breaks ABI for folks using -fshort-enums, and does not really buy
us anything.

http://llvm.org/PR40977

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver

Differential Revision: https://reviews.llvm.org/D59029

llvm-svn: 355521
  • Loading branch information
ldionne committed Mar 6, 2019
1 parent 67f3690 commit 930007b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions libcxx/include/atomic
Expand Up @@ -586,7 +586,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER > 17

enum class memory_order: unsigned {
enum class memory_order {
relaxed, consume, acquire, release, acq_rel, seq_cst
};

Expand All @@ -597,22 +597,16 @@ inline constexpr auto memory_order_release = memory_order::release;
inline constexpr auto memory_order_acq_rel = memory_order::acq_rel;
inline constexpr auto memory_order_seq_cst = memory_order::seq_cst;

static_assert((is_same<underlying_type<memory_order>::type,
unsigned>::value), "Underlying type differs from unsigned unexpectedly");

#else

typedef enum memory_order {
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;

static_assert((is_same<underlying_type<memory_order>::type,
unsigned>::value), "Underlying type differs from unsigned unexpectedly");

#endif // _LIBCPP_STD_VER > 17

typedef underlying_type<memory_order>::type __memory_order_underlying_t; // unsigned
typedef underlying_type<memory_order>::type __memory_order_underlying_t;


#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \
Expand Down

0 comments on commit 930007b

Please sign in to comment.