You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So for the following code snippet in this repo, if we include and use them in diff compile units(eg. different .m files) the block in dispatch_once will be executed once for each compile units.
Background
The NS_INLINE is defined as follows
Issue
So for the following code snippet in this repo, if we include and use them in diff compile units(eg. different .m files) the block in
dispatch_once
will be executed once for each compile units.eg.
https://github.com/apple/swift-corelibs-foundation/blob/778dde90ff7cf63f05634c3df6b0788c89249770/Darwin/shims/NSCalendarShims.h#L17-L26
https://github.com/apple/swift-corelibs-foundation/blob/778dde90ff7cf63f05634c3df6b0788c89249770/Darwin/shims/NSLocaleShims.h#L17-L24
https://github.com/apple/swift-corelibs-foundation/blob/778dde90ff7cf63f05634c3df6b0788c89249770/Darwin/shims/NSTimeZoneShims.h#L25-L32
Example project
CDemoKit.zip
Solution
__inline__ __attribute__((always_inline))
directly instead of usingNS_INLINE
Other info
https://forums.swift.org/t/potential-issue-for-ns-inline-dispatch-once-on-swift-corelibs-foundation/70439
The text was updated successfully, but these errors were encountered: