[Swift] Unable to use majority of stdatomic

Originator:zach
Number:rdar://27161329 Date Originated:04-Jul-2016 11:18 AM
Status:Duplicate/17171396 Resolved:false
Product:Developer Tools Product Version:Xcode Version 8.0 beta (8S128d)
Classification:Other Bug Reproducible:Always
 
Summary:
The 10.12 SDK adds `stdatomic.h` to its module map, thus exposing its capabilities in line with C11 to Swift. (stdatomic.h was first available to the public in Xcode 7.)

In turn, the OSAtomic facilities were deprecated beginning in 10.12 in favor of the C11 constructs. These are unavailable in Swift, making simple value-based lock-free programming more difficult without bridging to C when targeting the new SDK as a minimum deployment target.

Steps to Reproduce:
1. Create a Swift project
2. `import Darwin.C.stdatomic` 
3. Cmd-click on `stdatomic`
4. Observe

Expected Results:
Swift imports definitions from section "7.17.7 Operations on atomic types", such as `atomic_exchange_explicit(_:_:_:)`.

Actual Results:
Swift only imports the straightforward #defines and direct C structs and functions.

Version:
Xcode Version 8.0 beta (8S128d) / OS X El Capitan Version 10.11.5 (15F34)

Notes:
This is behavior to be expected from the perspective of the Clang importer; it is likely that Swift should gyb overloads for the atomics-compatible types in the C stdlib overlay. Swift itself benefits from using LLVM's instruction set directly. IMHO, Swift should expose any capabilities of C11 that are representable in Swift. 

Configuration:
Occurs under all versions of Swift against the macOS 10.12 SDK.

Attachments:

Comments

Engineering has determined that your bug report (27161329) is a duplicate of another issue (17171396) and will be closed.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!