Commit Graph

16 Commits

Author SHA1 Message Date
Max Desiatov
21a2b78801 stdlib/benchmark: add canImport(Musl) where needed (#67120)
This allows compiling stdlib and benchmarks when targeting musl instead of Glibc.
2023-07-05 19:55:08 +01:00
Max Desiatov
372ada0e24 test: add handling for Wasm/WASI (#39519)
This change adds support for WASI in stdlib tests. Some tests that expect a crash to happen had to be disabled, since there's currently no way to observe such crash from a WASI host.
2022-01-12 14:24:50 +00:00
Saleem Abdulrasool
2fc5cbdc14 stdlib: remove swiftMSVCRT, replace with swiftCRT on Windows
This replaces swiftMSVCRT with swiftCRT.  The big difference here is
that the `visualc` module is no longer imported nor exported.  The
`visualc` module remains in use for a singular test wrt availability,
but this should effectively remove the need for the `visualc` module.

The difference between the MSVCRT and ucrt module was not well
understood by most.  MSVCRT provided ucrt AND visualc, combining pieces
of the old MSVCRT and the newer ucrt.  The ucrt module is what you
really wanted most of the time, however, would need to use MSVCRT for
the convenience aliases for type-generic math and the deprecated math
constants.

Unfortunately, we cannot shadow the `ucrt` module and create a Swift SDK
overlay for ucrt as that seems to result in circular dependencies when
processing the `_Concurrency` module.

Although this makes using the C library easier for most people, it has a
more important subtle change: it cleaves the dependency on visualc.
This means that this enables use of Swift without Visual Studio for the
singular purpose of providing 3 header files.  Additionally, it removes
the need for the installation of 2 of the 4 support files.  This greatly
simplifies the deployment process on Windows.
2020-10-15 16:02:01 -07:00
Robert Widmann
cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00
3405691582
d69912761a Ensure consistency of ordering in preprocessor conditionals.
Co-Authored-By: Xiaodi Wu <13952+xwu@users.noreply.github.com>
2020-03-03 20:24:06 -05:00
3405691582
5847726f51 Preliminary support for OpenBSD in the stdlib.
These should hopefully all be uncontroversial, minimal changes to deal
with progressing the build to completion on OpenBSD or addressing minor
portability issues. This is not the full set of changes to get a
successful build; other portability issues will be addressed in future
commits.

Most of this is just adding the relevant clauses to the ifdefs, but of
note in this commit:

* StdlibUnittest.swift: the default conditional in _getOSVersion assumes
  an Apple platform, therefore the explicit conditional and the relevant
  enums need filling out. The default conditional should be #error, but
  we'll fix this in a different commit.

* tgmath.swift.gyb: inexplicably, OpenBSD is missing just lgammal_r.
  Tests are updated correspondingly.

* ThreadLocalStorage.h: we use the pthread implementation, so it
  seems we should typedef __swift_thread_key_t as pthread_key_t.
  However, that's also a tweak for another commit.
2020-03-01 12:50:06 -05:00
Chris Amanse
e13ea48dcd Private method should be for non-Windows only 2020-01-29 14:14:12 -08:00
Chris Amanse
ffa6bf4729 Fix memory leaks in ThreadBarriers.swift (#12212)
* Fix memory leaks in ThreadBarriers.swift

* Fatal error on pthread cond/mutex destroy failure

* Rename pthread to thread

* Fix pthread init function calls

* Fix guard statement
2020-01-29 08:21:52 -08:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Xiaodi Wu
9fe28c6e55 [gardening] Fix header comments [NFC] 2018-12-02 15:38:41 -05:00
Saleem Abdulrasool
98d71ff38f SwiftPrivateThreadExtras: clean up using WinSDK SDK overlay
Use the constants rather than hardcoding values.
2018-12-01 11:04:13 -08:00
Saleem Abdulrasool
e1d7ee79e4 stdlib: implement ThreadBarriers in terms of Windows threading 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
65bdce00b6 stdlib: rename _stdlib_PTHREAD_BARRIER_SERIAL_THREAD -> _stdlib_THREAD_BARRIER_SERIAL_THREAD 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
7b06586fe1 stdlib: rename _stdlib_pthread_barrier_t to _stdlib_thread_barrier_t 2018-11-26 13:09:49 -08:00
Saleem Abdulrasool
82360c6b27 stdlib: remove pthread_barrier attributes
These were not in use, and removing this from the signature makes it
possible to re-use the exact signature on Windows more easily.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
0693bec1f1 sdlib: rename SwiftPrivatePthreadExtras to SwiftPrivateThreadExtras
This is in preparation to make the code here more target agnostic for
porting to the Windows threading primitives.  This is used pretty
extensively in the tests, so disabling tests would lose a chunk of
coverage.
2018-11-26 13:09:31 -08:00