* [Foundation] Fix availability of NSValue.value(of:)
(cherry picked from commit fbe5563d60)
* [Foundation] NSValue.value(of:): Reinstate runtime OS version check
Although it's a static archive, its use is only relevant to dynamically linked builds of the
standard library. (If you're statically linking a Swift runtime into your process, you don't
need to worry about compatibility with older runtimes.)
Many build systems that support Swift don't use swiftc to drive the linker. To make things
easier for these build systems, also use autolinking to pull in the needed compatibility
libraries. This is less ideal than letting the driver add it at link time, since individual
compile jobs don't know whether they're building an executable or not. Introduce a
`-disable-autolink-runtime-compatibility` flag, which build systems that do drive the linker
with swiftc can pass to avoid autolinking.
rdar://problem/50057445
Instead of a thunk insert the dispatch into the original function.
If the original function should be executed the prolog just jumps to the "real" code in the function. Otherwise the replacement function is called.
There is one little complication here: when the replacement function calls the original function, the original function should not dispatch to the replacement again.
To pass this information, we use a flag in thread local storage.
The setting and reading of the flag is done in two new runtime functions.
rdar://problem/51043781
The comment in the function said:
// This function is implemented in Objective-C because Swift does not support
// failing initializers.
which hasn't been true since swift 1.1.
This splits out the bionic modulemap from the glibc modulemap. They are
sufficiently different that the duplication is worth it. Furthermore,
it will enable properly identifying the libc on android. Once fully
detangled, this will enable the use of bionic on non-android platforms.
StdlibUnittest uses an AtomicBool to track whether a failure has ocurred
in a test. Before this, expectFailure could have a false-positive
failure due to a race condition on the _anyExpectFailed.
The following interleaving would trigger the issue:
A: loads false
A: stores false
B: loads false
A: stores true
B: stores false
A: loads false (after body)
This causes A to see a false-positive failure.
Build a static archive that can be linked into executables and take advantage of the Swift runtime's
hooking mechanism to work around the issue Doug fixed in https://github.com/apple/swift/pull/24759.
The Swift 5.0 version of swift_conformsToProtocol would return a false negative in some cases where
a subclass conforms using an inherited conformance, so work around this by successively retrying
the original implementation up the superclass chain to try to find a match.
`convertFromSnakeCase` and `convertToSnakeCase` are not inverses of each other for keys like "pictureURL" (which roundtrips to "pictureUrl").
This does not fix the underlying issue, but improves the error message if this situation is detected.
These functions have never actually been supported in Swift, because Swift does not model the dynamic floating point environment. They may have worked occasionally in the past, but that was only accidental. Deprecate them with an explanatory message.