[all-commits] [llvm/llvm-project] aac5b8: [libc++] Improve atomic_fetch_(add|sub).*.

mordante via All-commits all-commits at lists.llvm.org
Fri Oct 8 08:42:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aac5b84d4bf7cbb84e7adc491380bf5bfcb8f61b
      https://github.com/llvm/llvm-project/commit/aac5b84d4bf7cbb84e7adc491380bf5bfcb8f61b
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/include/atomic
    A libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp
    A libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp
    A libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp
    A libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
    M libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp

  Log Message:
  -----------
  [libc++] Improve atomic_fetch_(add|sub).*.

While looking at the review comments in 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

Libc++ allows usage of
`atomic_fetch_add<int>(atomic<int*>*, atomic<int*>::difference_type);`
MSVC and GCC reject this code: https://godbolt.org/z/9d8WzohbE

This makes the atomic `fetch(add|sub).*` Standard conforming and removes the non-conforming extensions.

Fixes PR47908

Reviewed By: ldionne, #libc

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




More information about the All-commits mailing list