[libcxx-commits] [PATCH] D103983: [libc++][rfc] Improve atomic_fetch_(add|sub).*.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 9 11:41:27 PDT 2021


Mordante created this revision.
Mordante added a reviewer: ldionne.
Herald added a subscriber: jfb.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

While looking at the review comments in D103765 <https://reviews.llvm.org/D103765> there was an oddity in
the tests for the following functions:

- atomic_fetch_add
- atomic_fetch_add_explicit
- atomic_fetch_sub
- atomic_fetch_sub_explicit

It has been reported as PR47908. This is a proof-of-concept for
addressing the issue. With libc++ it's valid to use
`atomic_fetch_add<int>(atomic<int*>*, atomic<int*>::difference_type);`
MSVC and GCC reject this code: https://godbolt.org/z/9d8WzohbE

The question is do we want to keep the current non-conforming code or do
we want to remove it?

Note:

- the patch only addresses issue in atomic_fetch_add
- the modified constrains haven't been tested fully yet


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103983

Files:
  libcxx/include/atomic
  libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103983.350964.patch
Type: text/x-patch
Size: 3713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210609/db1fd84f/attachment.bin>


More information about the libcxx-commits mailing list