public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/89624] HLE acquire/release bits in std::memory_order don't work with -fshort-enums or -fstrict-enums Date: Thu, 11 Apr 2024 11:10:55 +0000 [thread overview] Message-ID: <bug-89624-4-SfaAED574x@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-89624-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89624 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I think we should just do this: --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; #else - typedef enum memory_order + enum memory_order : int { memory_order_relaxed, memory_order_consume, @@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION memory_order_release, memory_order_acq_rel, memory_order_seq_cst - } memory_order; + }; #endif /// @cond undocumented That ensures a consistent underlying type for C++17 down and C++20 up (and gets rid of the redundant typedef). This will mean the type isn't affected by the -fshort-enums flag at all, which also happens to solve the static_assert failure in comment 0. This is an ABI change for the underlying type when using -fshort-enums, but that flag is already explicitly ABI-changing and not the default, so I care less about a change there.
next prev parent reply other threads:[~2024-04-11 11:10 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-89624-4@http.gcc.gnu.org/bugzilla/> 2024-04-09 3:26 ` pinskia at gcc dot gnu.org 2024-04-11 11:10 ` redi at gcc dot gnu.org [this message] 2024-04-11 11:13 ` redi at gcc dot gnu.org 2024-05-15 9:19 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-89624-4-SfaAED574x@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).