Title
Consider ATOMIC_FLAG_INIT undeprecation
Status
c++23
Section
[atomics.flag]
Submitter
Aaron Ballman

Created on 2022-01-18.00:00:00 last changed 4 months ago

Messages

Date: 2022-07-25.20:32:58

Proposed resolution:

This wording is relative to N4910.

  1. Modify [atomics.syn], Header <atomic> synopsis, as indicated:

    void atomic_flag_notify_all(volatile atomic_flag*) noexcept;
    void atomic_flag_notify_all(atomic_flag*) noexcept;
    #define ATOMIC_FLAG_INIT see below
    
    // [atomics.fences], fences
    extern "C" void atomic_thread_fence(memory_order) noexcept;
    extern "C" void atomic_signal_fence(memory_order) noexcept;
    
  2. Move the content of [depr.atomics.flag] from Annex D to the end of [atomics.flag].

    #define ATOMIC_FLAG_INIT see below
    

    Remarks: The macro ATOMIC_FLAG_INIT is defined in such a way that it can be used to initialize an object of type atomic_flag to the clear state. The macro can be used in the form:

      atomic_flag guard = ATOMIC_FLAG_INIT;
    

    It is unspecified whether the macro can be used in other initialization contexts. For a complete static-duration object, that initialization shall be static.

  3. Modify [stdatomic.h.syn] C compatibility, as indicated:

    using std::atomic_flag_clear;            // see below
    using std::atomic_flag_clear_explicit;   // see below
    #define ATOMIC_FLAG_INIT see below
    
    using std::atomic_thread_fence;          // see below
    using std::atomic_signal_fence;          // see below
    
  4. Modify [depr.atomics.general] in Annex D as indicated:

    #define ATOMIC_VAR_INIT(value) see below
    
    #define ATOMIC_FLAG_INIT see below
    }
    
Date: 2022-07-25.00:00:00

[ 2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP. ]

Date: 2022-07-15.00:00:00

[ 2022-07-15; LWG telecon: move to Ready ]

Date: 2022-07-15.00:00:00

[ 2022-07-11; Reflector poll ]

Set status to Tentatively Ready after six votes in favour during reflector poll.

Date: 2022-07-15.00:00:00

[ 2022-07-06; SG1 confirm the direction, Jonathan adds wording ]

"In response to LWG 3659, add ATOMIC_FLAG_INIT to <stdatomic.h> as undeprecated."

SFFNASA
30000

"In response to LWG 3659, undeprecate ATOMIC_FLAG_INIT in <atomic>."

SFFNASA
23100
Date: 2022-01-15.00:00:00

[ 2022-01-30; Reflector poll ]

Set priority to 3 after reflector poll. Send to SG1.

Date: 2022-01-22.13:10:36

P0883R2 deprecated ATOMTIC_VAR_INIT and ATOMIC_FLAG_INIT largely based on rationale from WG14. However, WG14 only deprecated ATOMIC_VAR_INIT because we were told by implementers that ATOMIC_FLAG_INIT is still necessary for some platforms (platforms for which "clear" is actually not all zero bits, which I guess exist).

I'd like to explore whether WG21 should undeprecate ATOMIC_FLAG_INIT as there was no motivation that I could find in the paper on the topic or in the discussion at P0883R0 [Jacksonville 2018].

One possible approach would be to undeprecate it from <stdatomic.h> only (C++ can still use the constructors from <atomic> and shared code can use the macros from <stdatomic.h>).

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-07-25 20:32:58adminsetmessages: + msg12636
2022-07-25 20:32:58adminsetstatus: ready -> wp
2022-07-25 20:28:19adminsetmessages: + msg12610
2022-07-11 10:09:12adminsetmessages: + msg12576
2022-07-11 10:09:12adminsetstatus: open -> ready
2022-07-06 20:36:49adminsetmessages: + msg12557
2022-07-06 20:36:49adminsetmessages: + msg12556
2022-01-30 17:05:36adminsetmessages: + msg12329
2022-01-30 17:05:36adminsetstatus: new -> open
2022-01-18 00:00:00admincreate