public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-7177] libstdc++: Add atomic_fetch_xor to <stdatomic.h>
Date: Thu, 10 Feb 2022 13:04:18 +0000 (GMT) [thread overview]
Message-ID: <20220210130418.E125B3858415@sourceware.org> (raw)
https://gcc.gnu.org/g:3e539985cc7a28516054cc080ffd9681aa745afa
commit r12-7177-g3e539985cc7a28516054cc080ffd9681aa745afa
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Feb 9 13:38:33 2022 +0000
libstdc++: Add atomic_fetch_xor to <stdatomic.h>
This function (and the explicit memory over version) are present in both
C++ <atomic> and C <stdatomic.h>, so should be in C++ <stdatomic.h> too.
There is a library issue incoming for this, but the resolution is
obvious.
libstdc++-v3/ChangeLog:
* include/c_compatibility/stdatomic.h (atomic_fetch_xor): Add
using-declaration.
(atomic_fetch_xor_explicit): Likewise.
* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Check
arithmetic and logical operations for atomic_int.
Diff:
---
libstdc++-v3/include/c_compatibility/stdatomic.h | 2 ++
| 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h
index 95c72615b4e..c97cbac984e 100644
--- a/libstdc++-v3/include/c_compatibility/stdatomic.h
+++ b/libstdc++-v3/include/c_compatibility/stdatomic.h
@@ -111,6 +111,8 @@ using std::atomic_fetch_sub;
using std::atomic_fetch_sub_explicit;
using std::atomic_fetch_or;
using std::atomic_fetch_or_explicit;
+using std::atomic_fetch_xor;
+using std::atomic_fetch_xor_explicit;
using std::atomic_fetch_and;
using std::atomic_fetch_and_explicit;
using std::atomic_flag_test_and_set;
--git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
index 80d2e150647..6dd4f5b00ca 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
@@ -116,6 +116,17 @@ static_assert( requires (::atomic_int* i, int* e) {
::atomic_compare_exchange_weak_explicit(i, e, 3,
memory_order_acq_rel,
memory_order_relaxed);
+
+ ::atomic_fetch_add(i, 1);
+ ::atomic_fetch_add_explicit(i, 1, memory_order_relaxed);
+ ::atomic_fetch_sub(i, 1);
+ ::atomic_fetch_sub_explicit(i, 1, memory_order_relaxed);
+ ::atomic_fetch_and(i, 1);
+ ::atomic_fetch_and_explicit(i, 1, memory_order_relaxed);
+ ::atomic_fetch_or(i, 1);
+ ::atomic_fetch_or_explicit(i, 1, memory_order_relaxed);
+ ::atomic_fetch_xor(i, 1);
+ ::atomic_fetch_xor_explicit(i, 1, memory_order_relaxed);
} );
static_assert( requires (::atomic_flag* f) {
reply other threads:[~2022-02-10 13:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220210130418.E125B3858415@sourceware.org \
--to=redi@gcc.gnu.org \
--cc=gcc-cvs@gcc.gnu.org \
--cc=libstdc++-cvs@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: link
Be 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).