Commit Graph

353 Commits

Author SHA1 Message Date
Saleem Abdulrasool
47eb843f02 Merge pull request #67821 from stevapple/stevapple-patch-1-1
Remove `vcruntime._Private.xstddef`
2023-08-09 13:45:34 -07:00
Saleem Abdulrasool
af57672c0f Platform: further modularise vcruntime._Private
Create an explicit module for `xhash` to correct the usage for
`unordered_set`.
2023-08-09 13:45:21 -07:00
YR Chen
7c43dfb986 Remove vcruntime._Private.xstddef
`<xstddef>` was removed since MSVC 14.37. It isn't meant to be used by most users, but the reference will break all clients of `vcruntime`, including Swift standard library itself.
2023-08-09 18:53:00 +08:00
Saleem Abdulrasool
3de765cad3 Platform: correct requirements for std.unordered_set
This module requires C++11, not `unordered_set` which prevents the use
of the module.
2023-08-08 13:28:08 -07:00
Saleem Abdulrasool
81cab33a75 Platform: further modularise ucrt
Add a couple of submodules for these modules to further modularise the
headers.  This might expose additional APIs now as some of these headers
would not have been indirectly included and wind up in the wrong module.
2023-08-06 21:16:40 -07:00
Saleem Abdulrasool
3aec82da29 Platform: make stdint module implicit on Windows
This makes the `stdint` module implicit which repairs the ability to
build some components.  In order to accomplish this, we need to
potentially break the fragile Swift build system.  Due to the incorrect
handling of compilers we need some workarounds to support
cross-compilation.  This removes the injected system header paths when
building on Windows to ensure that the clang resource headers are not
following the system headers which breaks the modules as the clang
resources are dependent on the system headers when running in hosted
mode.
2023-08-04 15:37:59 -07:00
Saleem Abdulrasool
fc72e7cb0e Platform: add missing std._Private modules
Add the missing `std._Private.xstddef`, `std._Private.yvals`, and
`std._Private.yvals_core` modules.  This repairs the use of `std.map` as
a private member variable of a type with an explicit ctor.
2023-07-26 15:50:15 -07:00
Saleem Abdulrasool
d4c5f2a845 Platform: add an additional corecrt submodule
This was detected as missing when trying to re-modularise MSVCPRT.
2023-07-26 15:50:15 -07:00
Saleem Abdulrasool
04742d64e5 Platform: remove some deprecated modules from MSVCPRT
These modules were deprecated and do not exist in the distribution,
remove the commented out form.
2023-07-26 15:50:15 -07:00
Saleem Abdulrasool
e2466d05ab Platform: add some missing C++ modules for MSVCPRT
Add a couple of missing submodules to the modulemap.  This is for
completeness and to help with newer MSVCPRT releases.
2023-07-26 15:50:14 -07:00
Saleem Abdulrasool
39e1a72d56 Platform: add std._Private.xutility for Windows
This adds the `xutility` module to strip that from the first modular
inclusion of the header.
2023-07-26 15:50:14 -07:00
Saleem Abdulrasool
4667c12f48 Platform: introduce a std._Private module for Windows
These headers are not meant to be publicly consumed, introduce a
`_Private` module for internal use for the `std` module.
2023-07-26 15:50:14 -07:00
Saleem Abdulrasool
33f4bcb8b2 Platform: add std.iomanip on Windows
Add the missing submodule for `iomanip` on Windows.
2023-07-26 15:50:13 -07:00
Saleem Abdulrasool
c5fc76d995 Platform: add some version indicators on C++ submodules
Specify the C++ standard required for these submodules.  Although this
has no practical implications, it is useful for isolating the features
with different C++ standards.
2023-07-26 15:50:13 -07:00
Evan Wilde
669285fd17 Merge pull request #65534 from stephank/fix/cmake-3.25
build: fix accidental cmake expansions
2023-07-24 09:44:14 -07:00
Saleem Abdulrasool
a0500be652 Platform: add URL Monikers to the WinSDK overlay
Add a module definition for importing the URL Monikers interfaces.  This
is in service of DocC.
2023-07-23 14:33:57 -07:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Max Desiatov
7581e7241c stdlib/public/platform: rename ALPINE to MUSL in CMakeLists.txt 2023-07-06 15:45:16 +01:00
Max Desiatov
115ddf96d5 List all musl headers directly in musl.modulemap 2023-07-05 22:39:47 +01:00
Max Desiatov
0f5617e909 stdlib: add modulemap for Musl, add Musl platform module
This change is necessary to allow building Musl platform module when targeting Alpine Linux.
2023-07-05 22:26:55 +01:00
STREGA
9cc41fa80d Add DirectInput 2023-06-23 14:33:44 -04:00
Saleem Abdulrasool
8a4c6225ec Windows: add wincred.h to the modulemap
This adds the Windows credentials API to the modulemap for the Windows
SDK module.
2023-04-14 16:47:26 -07:00
Matt Jacobson
2febbb4aaf stdlib: implement POSIXErrorCode for FreeBSD
It shares many of the same values as OpenBSD (which both inherited from 4.4BSD),
and we wouldn't expect those to diverge due to the respective platforms'
bincompat goals.
2023-03-16 01:20:56 -04:00
Saleem Abdulrasool
90cacaa359 Platform: install Windows auxiliary files
These are now referenced directly by the compiler so install them as
part of the package.
2023-03-08 14:07:10 -08:00
Saleem Abdulrasool
19a0eaaa77 Windows: add conio and corecrt.conio
This adds `conio` and `corecrt.conio` modules to the ucrt modulemap to expose these interfaces to Swift.

Fixes: #63024
2023-01-30 11:43:06 -08:00
Evan Wilde
f8a54181a9 Zipper all the things!
This patch goes through and adds zippering and the swift module
dependencies to a bunch of pieces of the swift runtimes. Here's to
hoping I hit everything that needed to be hit. :D

With this patch, I'm seeing the appropriate modules under
lib/swift/maccatalyst, so things seem to be working right.
2022-12-22 13:41:59 -08:00
Matt Jacobson
8e6ce5c087 stdlib: install SwiftGlibc.h in static resources directory
When SwiftGlibc.h was added in #32404, no cmake code was added to copy it to the
static resources.  Copy it along with glibc.modulemap, which references it.
2022-11-18 07:27:04 -05:00
Egor Zhdan
ba31ca4ea6 [build] Remove unused GLIBC_INCLUDE_PATH macro
This macro was previously substituted when generating `glibc.modulemap` file during the compiler build. Now Swift detects the location of Glibc dynamically and injects `glibc.modulemap` into it using LLVM VFS. The last usage of `GLIBC_INCLUDE_PATH` was removed in `78c0540b`.

This also removes `SWIFT_SDK_${sdk}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY` which doesn't have any usages left.
2022-09-05 18:57:29 +01:00
Egor Zhdan
78c0540b6f [Glibc] Refer to UUID headers from the modulemap using relative paths
This improves portability of the Swift toolchains by removing a usage of absolute path to Glibc.

The Glibc modulemap is now injected into the Glibc include path using LLVM VFS, so it can reference Glibc headers using relative paths. This already works for other Glibc headers (e.g. `assert.h`)
2022-08-17 15:09:17 +01:00
Saleem Abdulrasool
b420071835 vcruntime: adjust module definition further
Add some of the x* headers to the c++ module.  These are included
multiply and so we create private modules for them rather than
associate them with a different module which could cause issues
in practice due to intra-module dependencies.
2022-08-14 08:02:12 -07:00
Egor Zhdan
c314ae0d17 [Glibc] Add missing C stdlib header
`assert.h` is missing from the modulemap, which causes clang to consider `assert.h` to be a part of the first module to include it. This causes issues in SwiftCompilerSources when we try to use classes coming from LLVM headers on Linux.
2022-07-05 16:45:18 +01:00
Saleem Abdulrasool
f57fe44fdb Update vcruntime.modulemap
Remove `spanstream` header from the module until we can identify a way to do per-release variants.
2022-06-28 19:01:41 -07:00
Saleem Abdulrasool
1779c569c8 Platform: add a definition for std on Windows
This adds the c++ module for Windows to help further the C++ interop.
2022-06-28 16:10:37 -07:00
Saleem Abdulrasool
01ae682b4a Platform: extend ucrt with some MSVC extensions
Add some additional modules which become necessary to support the C++
modularization.
2022-06-27 13:44:18 -07:00
Saleem Abdulrasool
52f8760255 Merge pull request #59723 from compnerd/corecrt
Platform: extract `corecrt` module
2022-06-27 13:24:27 -07:00
Saleem Abdulrasool
c7ee0a85a8 Platform: extract corecrt module
This extracts the `corecrt` module in order to setup the necessary
structure for enabling the `std` module for C++.
2022-06-27 08:58:05 -07:00
Saleem Abdulrasool
fc070c6167 platform: restructure visualc module
Restructure the `visualc` module into `vcruntime` in order to help
expose the various components (SAL, vcruntime, ucrt, corecrt, STL) for C++
modularization.  Include the `stdint.h` textually to deal with
redefinition of types in clang resources and MSVC.
2022-06-26 14:06:59 -07:00
Saleem Abdulrasool
a4b9d950a7 platform: correct header for ssse3
Correct the header spelling for the ssse3 module.  The suffix was
incorrect which was ignored as a result.  This was identified by the
`modularize` tool from clang-tools-extras.
2022-06-22 19:27:32 -07:00
Josh Soref
644c18ca9b Spelling stdlib (#42444)
* spelling: against

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: algorithmic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: alignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: anything

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architectural

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architecture

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: are

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: artificial

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aside

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: being

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bidirectional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: characters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: circular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compiled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correctly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: covers

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: descriptor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dictionaries

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: greater

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: immortal

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initializes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iterable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: minimum

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: originally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sophisticated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trivia

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: wasn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:43 -07:00
Saleem Abdulrasool
ca25261f73 Merge pull request #41710 from compnerd/intrinsics
visualc: add new `_visualc_intrinsics` module
2022-03-11 08:51:10 -08:00
Saleem Abdulrasool
0bc375d97c Revert "visualc: clean up the module definition"
This reverts commit c194d1cf24.
2022-03-07 18:25:25 -08:00
Saleem Abdulrasool
b7ceca333a visualc: add new _visualc_intrinsics module
This introduces the `_visualc_intrinsics` module, which is the MSVC
analogue to `_Builtin_intrinsics` from clang.  This is needed for the
ARM64 SDK build which will attempt to use the neon intrinsics during the
build.
2022-03-07 12:54:02 -08:00
Saleem Abdulrasool
c194d1cf24 visualc: clean up the module definition
Clean up the submodules in visualc to not export all imported modules.
The one special case is `vcruntime` which re-exports `SAL` due to a
dependency in the headers.  The import of `visualc` however will
re-export all submodules to keep the current behaviour.  This is
required to get the ARM64 SDK building on newer MSVC toolsets.
2022-03-07 10:59:00 -08:00
Robert Widmann
beda891274 Merge pull request #40557 from 3405691582/UnifiedModulemap 2022-02-21 22:45:55 -08:00
Saleem Abdulrasool
b3b8fa50c3 Merge pull request #41421 from compnerd/pepperidge-farm-remembers
Platform: add a new submodule to WinSDK
2022-02-18 08:22:33 -08:00
Philippe Hausler
e675b310f8 [SE-0329] Clock/Instant/Duration (#40609)
* [WIP] Initial draft at v2 Clock/Instant/Duration

* Ensure the literal types for _DoubleWide are able to be at least 64 bits on 32 bit platforms

* static cast timespec members to long

* Remove runtime exports from clock functions

* Export clock functions in implementations as they are in headers

* Clean up internal properties by adding leading underscores, refine availability to a TBD marker macro, and break at 80 lines to match style

* Shift operators to concrete Instant types to avoid complexity in solver resolution

* Adjust diagnostic note and error expectation of ambiguities to reflect new potential solver (perhaps incorrect) solutions

* Update stdlib/public/Concurrency/TaskSleep.swift

Co-authored-by: Karoy Lorentey <klorentey@apple.com>

* [stdlib][NFC] Remove trailing whitespace

* [stdlib] Remove _DoubleWidth from stdlib's ABI

* [stdlib] Strip downd _DoubleWidth to _[U]Int128

* Additional adjustments to diagnostic notes and errors expectation of ambiguities to reflect new potential solver (perhaps incorrect) solutions

* Disable type checker performance validation for operator overload inferences (rdar://33958047)

* Decorate Duration, DurationProtocol, Instant and clocks with @available(SwiftStdlib 9999, *)

* Restore diagnostic ambiguity test assertion (due to availability)

* Add a rough attempt at implementing time accessors on win32

* Remove unused clock id, rename SPI for swift clock ids and correct a few more missing availabilities

* remove obsolete case of realtime clock for dispatch after callout

* Use the default implementation of ~ for Int128 and UInt128

* Ensure diagnostic ambiguitiy applies evenly to all platforms and their resolved types

* Restore the simd vector build modifications (merge damage)

* Update to latest naming results for Instant.Duration

* Updates to latest proposal initializers and accessors and adjust encoding/decoding to string based serialization

* Update availability for Clock/Instant/Duration methods and types to be 5.7

* Correct *Clock.now to report via the correct runtime API

* Ensure the hashing of Duration is based upon the attoseconds hashing

* Avoid string based encoding and resort back to high and low bit encoding/decoding but as unkeyed

* Adjust naming of component initializer to use suffixes on parameters

* Duration decoding should use a mutable container for decoding

* fix up components initializer and decode access

* Add platform base initializers for timespec and tiemval to and from Duration

* Add some first draft documentation for standard library types Duration, DurationProtocol and InstantProtocol

* Another round of documentation prose and some drive-by availability fixes

* InstantProtocol availability should be 5.7

* Correct linux timeval creation to be Int and not Int32

Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2022-02-17 09:32:46 -08:00
Saleem Abdulrasool
67ba46e591 Platform: add a new submodule to WinSDK
This adds the memoryapi submodule to WinSDK which isolates the memoryapi
contract.  This enables additional functions such as
`QueryVirtualMemoryRegion` to now be available.
2022-02-16 18:02:53 -08:00
Saleem Abdulrasool
e6c6c5207b Platform: add submodule to WinSDK for ProcessAPI
This adds the PSAPI submodule to WinSDK for use in swift-inspect.
2022-02-12 18:23:03 -08:00
3405691582
600d500ed6 [stdlib] Use the single-header Glibc modulemap.
This migrates OpenBSD to use the single-header Glibc modulemap proposed
and implemented in #32404, and necessitates introducing some missing
headers for building Foundation added in #38341.

Additionally, incorporate nullability annotations in SwiftShims per
2022-02-11 13:04:12 -05:00
Robert Widmann
f5bc40be10 Merge pull request #35707 from buttaface/droid
[android] Switch to new single-header modulemap for Bionic too
2022-02-10 15:50:19 -08:00