Commit Graph

1242 Commits

Author SHA1 Message Date
Eric Miotto
7239481fef CMake: add Observation dependency to libraries that import Foundation...
when building for Apple platforms.

In this scenario we are not building our own Foundation,
but we are importing the one from the underlying SDK -- this in turns
requires Observation, which is something we typically build.

Addresses rdar://162286123
2025-10-16 10:27:35 -07:00
3405691582
9683569f25 OpenBSD 7.8 will require OpaquePointer for FILE. (#84478)
OpenBSD 7.8 snapshots hide the type information for FILE. Therefore, the
types for the standard stdio streams should (regrettably) be
OpaquePointer, due to the well-discussed issue of losing type
information for forward-declared C types.

We explicitly drop to void * in the LibcOverlayShims for backwards
compatibility, since OpenBSD 7.8 is not yet released.
2025-09-27 18:16:58 +05:30
Peter Rong
b396bd05a3 [stdlib] Add explict import to ReflectionTest to avoid name conflicts in stdlib and Darwin (#81953)
Similar to #77155 , we disambiguate stdin, stdout, and stderr now.

Signed-off-by: Peter Rong <PeterRong@meta.com>
2025-09-12 10:08:21 -07:00
Anton Korobeynikov
7668666ad2 Support differentiation of wrapped value modify accessors (#78794)
Some fixes for coroutines with normal results and `partial_apply` of coroutines were required.

Fixes #55084
2025-09-10 02:30:26 -07:00
Eric Miotto
732a216c7e CMake: readd StringProcessing dependency to StdlibUnittest
This reverts commit 4a95275bde.

I remove the dependency looking at the modules that StdlibUnittest
directly imports -- but it turns out we import StringProcessing
indirectly as a result of importing Foundation from e.g. the underlying
Apple SDKs.

Addresses rdar://158797152
2025-08-20 13:52:17 -07:00
Eric Miotto
1a8cca247d CMake: allow more private libraries to be used on older OSes
I missed a few when tackling #83602

Take the chance to ensure swiftStdlibUnittestFoundationExtras builds
zippered.

Addresses rdar://158264124
2025-08-14 10:52:15 -07:00
Eric Miotto
332fe6a475 CMake: allow private libraries to be used on older OSes
To do so, use the deployment target versions used for tests.

Addresses rdar://157622116
2025-08-07 15:12:47 -07:00
Eric Miotto
4a95275bde CMake: do not link StringProcessing into StdlibUnittest
Since #64187 we are not importing automatically StringProcessing when
building the stdlib -- this is especially important for StdlibUnittest,
since it needs to run on older OSes.

Addresses rdar://157622116
2025-08-07 15:06:52 -07:00
Meghana Gupta
222ee7389a Diagnose @_lifetime on targets that are Escapable
Lifetime dependencies can be attached to ~Escapable types only
2025-07-22 06:00:38 -07:00
Guillaume Lessard
6c588dc908 Merge pull request #82701 from glessard/rdar154776967-generalize-expectNil
[stdlibUnittest] generalize `expectNil(_:)`
2025-07-03 01:16:24 -07:00
Konrad 'ktoso' Malawski
e32d221e2a [StdlibUnittest] Warn if no tests were executed 2025-07-02 19:38:50 +09:00
Guillaume Lessard
987fedf46a [stdlibUnittest] generalize expectNil(_:) 2025-07-01 15:16:49 -07:00
Allan Shortlidge
71eede247f StdlibUnittest: Use @_lifetime instead of @lifetime.
Resolves a warning.
2025-06-11 12:49:43 -07:00
Guillaume Lessard
5895077382 [stdlibUnittest] generalize expectNotNil(_:)
Generalizes it for non-copyable and non-escapable values.
2025-06-06 09:14:27 -07:00
Ian Anderson
15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07:00
Eric Miotto
8c7e8550aa CMake: add explicit dependency to _Builtin_float to targets...
... that would import that as a result of importing Darwin from the SDK.

Amend my previous change to Differentiation and Distributed in this
sense.

Addresses rdar://150400049
2025-05-05 10:39:14 -07:00
Mike Ash
e3057031da [RemoteMirror] Fix AsyncTask child iteration.
Iterating child tasks depends on knowing the size of AsyncTask, and changing the size of the task broke it. Instead of relying on mirroring the full structure in our out-of-process definitions, add a debug variable to libswift_Concurrency that contains the size of AsyncTask.

While we're there, add some more validation to child task enumeration. Check each child task's metadata pointer to make sure that it actually points to the AsyncTask metadata, and have the inner loop also increment and check ChildTaskLoopCount to stop runaway iteration in that loop.
2025-04-08 13:09:29 -04:00
Guillaume Lessard
df33b83c78 [StdlibUnittest] add a TestRunPredicate for WASI 2025-03-21 15:47:25 -07:00
Alejandro Alonso
5d745fe5d5 Update MinimalCollections.swift 2025-03-13 10:50:06 -07:00
Alejandro Alonso
0646c61cf5 Fix bidirectional test to account for RandomAccess 2025-03-13 10:11:51 -07:00
Nate Cook
ff86a69dd7 Add a StdlibUnitTest modifier for requiring a stdlib version (#79838)
It would be great if this could also set the availability for the `code:`
block, but this at least cuts out some boilerplate.
2025-03-08 13:07:20 -06:00
Alejandro Alonso
708d72d2c3 Update tests for 6.1 Unicode 16 stdlib 2025-01-15 14:09:57 -08:00
Allan Shortlidge
17fd27554b stdlib: Adopt internal imports to suppress some warnings in tests. 2024-11-13 09:51:29 -08:00
Daniel Rodríguez Troitiño
63022333d8 [unittest] Disambiguate references to errno (#77155)
In Xcode 16 SDKs there seem to be two `errno` visible for some files,
one in the `Darwin` module, and one in the `_errno` module (which seems
new for this Xcode version).

Disambiguate the references by prepending `Darwin`, which should be the
one that was being used before Xcode 16 SDKs.
2024-10-22 15:48:56 -07:00
Alastair Houghton
0963036734 [Build] Make sure we declare LINUX_STATIC dependencies on Musl.
Everywhere there's a `SWIFT_MODULE_DEPENDS_LINUX Glibc`, there should be
a corresponding `SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl`.

This usually won't bite us, depending on build order and parallelism, but
I hit one of these yesterday so went looking to see if there were any
others.

rdar://136208589
2024-09-18 09:40:58 +01:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Alexander Cyon
c21b1e68fd [stdlib] Fix typos 2024-07-06 13:09:57 +02:00
Alex Lorenz
57b89d5303 [android] add an android NDK Swift overlay module, and use it instead of Glibc 2024-05-28 12:57:38 -07:00
Alastair Houghton
0fa5e65bb2 [Stdlib][Build] Fix the standard library build for fully static Linux.
Mostly this just means adding `Musl` as a module dependency of various
things and making sure that we build things for `swift_static` even
if `SWIFT_BUILD_STATIC_STDLIB` isn't enabled.

There's also a slight difference in the declaration of `memcmp()`;
musl's declaration is more like the one we have on Darwin.

rdar://123508245
2024-05-07 16:56:20 +01:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Finagolfin
09ef130457 [android] Update to LTS NDK 26c
NDK 26 renamed the directory in which it places the Android compiler-rt from
`lib64/`, and added a bunch of nullability annotations to the Bionic libc.
2024-02-28 22:11:38 +05:30
Max Desiatov
633d5bc45a Enable x86_64 and i686 ELF triples for embedded Swift (#70642)
This is just as useful for x86 bare metal as the already enabled `arm*-none-none-eabi` triples.
2024-01-26 21:39:17 +00:00
Guillaume Lessard
50b83c8e69 Merge pull request #68423 from glessard/se0405-take2
[se-0405] rename `String.init(validatingUTF8:)`
2024-01-22 09:29:21 -08:00
Daniel Rodríguez Troitiño
e2d420835d [test] Make BlocksRuntimeStubs use never_install component. (#70545)
For some reason, 4 years ago, in ea90256 I added this target to `dev`,
which does not make sense because these stubs are only intended for
testing. Make them `never_install` to avoid distributing them when doing
`install-dev`.
2023-12-19 18:05:43 -08:00
Nate Chandler
10ce0c6b16 [SILGen] Used move_value for lexical lets.
Instead of using begin_borrow [lexical] + copy_value.
2023-12-14 13:35:26 -08:00
Ian Anderson
4dbc58723a [CMake] [Darwin] Don't add the Darwin overlay as a dependency if the overlays aren't being built
Allow for the overlays to not be built in Darwin by respecting SWIFT_BUILD_SDK_OVERLAY.
2023-10-17 11:03:57 -07:00
Yuta Saito
cdd01f9df2 [wasm][cmake] Add WASI specific stdlib dependencies
WASI target has its own libc module WASILibc, so we need to add it as
well as other libc modules.
2023-09-25 18:18:50 +00:00
Guillaume Lessard
0c916f507d [stdlib] replace uses of String(validatingUTF8:)
- use the new name `String(validatingCString:)`
2023-09-11 14:17:05 -07:00
Max Desiatov
fc1043ec3b StdlibUnittest: fix building with WASI (#67394)
This file can now be built for WASI when `WASILibc` is imported. Only slight branching is needed to disable child process spawning for this platform.
2023-07-19 18:51:40 +01:00
Max Desiatov
972af58bba WASI: support emulated signals in InterceptTraps.cpp (#67393)
When building with `_WASI_EMULATED_SIGNAL` excluding signal support on WASI is no longer needed.
2023-07-19 18:50:54 +01:00
Mike Ash
ea6a2e26f2 [Test] Remove stdlib/NSStringAPI.swift and some supporting code.
This is testing the Foundation overlay, which is no longer part of the Swift project.
2023-07-12 12:18:58 -04:00
Max Desiatov
9943f73d0f SwiftPrivate/IO.swift: unify #if canImport checks on non-Windows platforms (#67142)
This simplifies the import statements and adds support for WASILibc.
2023-07-06 10:16:41 +01:00
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
Yuta Saito
21d1e961bc [build] Fix cmake config for reflection test without dynamic stdlib
Build SwiftReflectionTest only if swift-reflection-test is available
because it depends on the tool and the tool is not available when no
dynamic stdlib is built
2023-06-29 11:22:38 +00:00
swift-ci
6b19b852e9 Merge pull request #65953 from Catfish-Man/contiguous-conundrum-tests-2
Add some tests for default implementations on RangeReplaceableCollection
2023-05-18 21:29:27 -07:00
David Smith
9beb1c1147 Build fix 2023-05-18 16:54:25 -07:00
Doug Gregor
8b4fe6be18 Eliminate some unnecessary shadowing generic parameters 2023-05-17 11:04:11 -07:00
David Smith
42d60c3c9c Add some tests for default implementations on RangeReplaceableCollection 2023-05-16 12:27:27 -07:00