However, when building Glibc with assertions enabled, LLVM asserts in
CodeGenModule::EmitGlobal with "Cannot emit local var decl as global".
This assert is _probably_ wrong in LLVM because the local extern
reference isn't being handled properly and needs to be addressed there.
We could move the declaration to global scope, but that is not ideal
because it makes the pointer declaration visible to Swift.
OpenBSD needs to implement _swift_stdlib_getEnviron regardless, so
let's do so.
The inclusion of Windows.h would cause the Shims to depend on WinSDK, which
would in turn depend on MSVCRT. However, the SwiftShims are using in MSVCRT
causing a circular dependency between WinSDK and MSVCRT preventing a clean build
from succeeding. Break the dependency by only including libc headers in the
shims header.
Revert #20194, which seems to be more trouble than it's worth. Instead, move the functions that SwiftPrivate needs back into LibcShims.h/cpp as SPI.
rdar://problem/45817565
When this header is used to create a module, it is used in a "C" environment,
which means that we cannot use the C++ style casts. Switch to the
old-style-cast. If we need to, we can always use `-Wno-old-style-casts` to
silence the warnings in C++ mode.