tera
1
i can not see a deprecation warning for OSAtomicIncrement32 during compilation despite of this in the header:
@available (iOS, deprecated: 10.0, message: "Use atomic_fetch_add_explicit(memory_order_relaxed) from <stdatomic.h> instead")
is this a bug?
Jon_Shier
(Jon Shier)
2
What’s your deployment target? Anything less than 10 wont show the warning.
1 Like
Jon_Shier
(Jon Shier)
4
You're right, I can reproduce this in my iOS 13 projects as well. You should report it as a bug.
tera
5
i was hoping it is somehow "undeprecated" as i don't see an easy way to use atomic_fetch_add_explicit from swift without jumping through hoops.
Jon_Shier
(Jon Shier)
6
@scanon or @lorentey Do you know the status of these APIs? It seems possible the deprecation was disabled in a way that isn't visible to us.
scanon
(Steve Canon)
7
The most likely explanation is that the OSAtomic.h header has been included with OSATOMIC_USE_INLINED=1 defined, which causes the deprecation warning to be suppressed and expands the legacy OSAtomic operations with their <stdatomic.h> replacements inline. Note that this is intended as a transition assistant; C users should still plan to migrate to the <stdatomic.h> bindings, and Swift users should plan to migrate to whatever Swift settles on for atomics.
Quoting the OSAtomic header:
* These are deprecated legacy interfaces for atomic operations.
* The C11 interfaces in <stdatomic.h> resp. C++11 interfaces in <atomic>
* should be used instead.
*
* Define OSATOMIC_USE_INLINED=1 to get inline implementations of these
* interfaces in terms of the <stdatomic.h> resp. <atomic> primitives.
* This is intended as a transition convenience, direct use of those primitives
* is preferred.
3 Likes