Commit Graph

8 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
c2c1bfb053 Add SWIFT_STDLIB_HAS_ENVIRON to remove usage of getenv/environ from stdlib (#39599) 2021-10-12 07:16:36 -07:00
3405691582
a6b0e926fd [stdlib] Both FreeBSD and OpenBSD use environ.
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.
2020-06-24 18:42:59 -04:00
3405691582
9cc07c7a4a [test][stdlib] Define stdio stubs for OpenBSD.
These are macros on OpenBSD, which don't get imported to an equivalent
symbol in Swift.
2020-06-11 20:17:35 -04:00
Saleem Abdulrasool
39621a51e7 SwiftShims: break circular dependency in MSVCRT
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.
2018-12-26 14:11:04 -08:00
Mike Ash
45693049bf [Stdlib] Remove SwiftPrivate's dependency on Darwin.
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
2018-11-06 17:41:56 -05:00
Saleem Abdulrasool
a5ed7fc34f stdlib: use __swift_ssize_t instead of ssize_t (NFC)
`ssize_t` is not available on Windows.  We have an internal type definition
`__swift_ssize_t` which allows us to use the type.  Switch to that spelling.
2018-10-05 11:19:07 -07:00
Saleem Abdulrasool
72be1dcda9 stdlib: use "C" style casts in the overlay shims
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.
2018-10-05 11:18:00 -07:00
Mike Ash
5f17b450c3 [Stdlib] Make all the functions in LibcShims.h either INTERNAL or inline. Move LibcShimsInline.h to LibcOverlayShims.h for more consistent naming. Fix up several tests that needed the mock Darwin overlay built. Fix one SourceKit test that no longer produces is_system: 1 on an import Darwin line. 2018-10-03 09:55:34 -04:00