Commit Graph

21803 Commits

Author SHA1 Message Date
Doug Gregor
8378562e12 Adopt @unsafe throughout the standard library
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.
2024-08-19 14:33:09 -07:00
Alex Lorenz
c8fa166e58 [cxx][windows] fix the CxxStdlib build for recent MSVC versions after recent regression
The build regressed after cbaef38968 as newer versions of MSVC that aren't used in the OSS CI yet fail to build CxxStdlib now
2024-08-19 10:55:22 -07:00
Egor Zhdan
28078d65be Merge pull request #75608 from CrazyFanFan/crazy_fan/75110
[c++-interop] Improve performance of creating a C++ `std::string` from a contiguous UTF-8 `Swift.String`
2024-08-19 15:40:43 +01:00
Rose
ea2b116764 Specify atomicity for compare_exchange_strong
waitQueue only needs to atomically be set to nullptr
2024-08-18 18:28:45 -04:00
Doug Gregor
73ecefd1e6 Merge pull request #75913 from DougGregor/typed-throws-with-unsafe-buffer-ptr
Adopt typed throws in withUnsafe(Mutable)BufferPointer
2024-08-17 09:16:49 -07:00
Yuta Saito
ba63b9f628 Merge pull request #75821 from kateinoigakukun/pr-680047d2b871e809cf13f27c8a4a5abc2f5c31d2
[wasm] Annotate errno as SwiftPrivate by apinotes
2024-08-17 14:35:42 +09:00
Doug Gregor
f8d483da0e Restore comment accidentally removed in typed throws adoption 2024-08-16 14:10:08 -07:00
Doug Gregor
8760b7caad Consistently use @usableFromInline and remove redundant @inlinables 2024-08-16 13:03:07 -07:00
Ian Anderson
fa72680d28 Merge pull request #75926 from ian-twilightcoder/lgamma_r-fix
[Shims] Don't redeclare lgamma_r in macOS 15.0 and associated SDKs
2024-08-16 12:51:44 -07:00
Doug Gregor
45a44a7d01 Use @_alwaysEmitIntoClient for new entrypoints 2024-08-16 11:13:19 -07:00
Doug Gregor
4d037ce6ef Adopt typed throws for withUnsafeMutableBufferPointer 2024-08-16 11:13:19 -07:00
Doug Gregor
5c07fd9502 Adopt typed throws in withUnsafeBufferPointer.
Part of rdar://131405937.
2024-08-16 11:13:18 -07:00
Evan Wilde
9fe62a832a Merge pull request #75870 from etcwilde/ewilde/main-add-musl-sdk-target-library
Fix add_swift_target_library for the static SDK
2024-08-16 09:51:44 -07:00
Ian Anderson
07a639ca9c [Shims] Don't redeclare lgamma_r in macOS 15.0 and associated SDKs
macOS 15.0, iOS 18.0, et al has started unconditionally declaring `lgamma_r` in <math.h>, add a __has_include in SwiftShims to detect that and not redeclare it when building against those SDK versions.

rdar://115192929
2024-08-16 09:00:09 -07:00
Yuta Saito
be08ebb12a [wasm] Annotate errno as SwiftPrivate by apinotes
This patch adds an apinotes file for SwiftWASILibc clang module to mark
`errno` macro hidden from Swift code. This resolves ambiguity between
the C macro definition and the Swift wrapper in WASILibc overlay module.

This change installs the apinotes file to the resource directories for
both lib/swift/apinotes and lib/swift_static/apinotes.
2024-08-16 10:57:24 +00:00
Harlan Haskins
a721ef63f6 Un-deprecate Task.startOnMainActor (#75544) 2024-08-16 06:36:18 +09:00
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
Mykola Pokhylets
66871b922d Deterministically crash in DefaultActorImpl::destroy() when self escapes in deinit 2024-08-15 12:43:48 +02:00
Egor Zhdan
8e2f0e2d50 Merge pull request #75877 from swiftlang/egorzhdan/std-map-init
[cxx-interop] Allow initializing `std::map` from Swift Dictionary
2024-08-14 21:49:56 +01:00
Egor Zhdan
9fe13ece49 [cxx-interop] Allow initializing std::map from Swift Dictionary
This adds initializers for `std::map` and `std::unordered_map` that take a Swift dictionary as a single parameter.

rdar://133691563
2024-08-14 13:32:30 +01:00
Egor Zhdan
915b5312ba Merge pull request #75662 from ADKaster/disable-tbb-execution-on-newer-libstdcxx
[cxx-interop] Disable c++ execution header with libstdcxx versions >= 11
2024-08-14 13:15:19 +01:00
Evan Wilde
cae88d3344 Fix add_swift_target_library for the static SDK
add_swift_target_library was missing pieces for passing sources and
flags to the static SDK build. As a result, the static SDK was missing
pieces (specifically Mutex).

Also adding the Musl import to the Linux Mutex implementation.
2024-08-13 15:59:31 -07:00
Mykola Pokhylets
6151731d26 Updated implementation to handle SWIFT_CONCURRENCY_ACTORS_AS_LOCKS 2024-08-13 12:30:21 +02:00
Crazy凡
cbaef38968 [c++-interop] Improve performance of creating a C++ std::string from a contiguous UTF-8 Swift.String 2024-08-13 13:58:56 +08:00
Alex Lorenz
d35af38ce4 Merge pull request #75721 from hyp/eng/75691
[windows] split out complex module from ucrt module, to allow new swi…
2024-08-12 08:30:47 -07:00
Yuta Saito
90799cfdf7 Revert "[wasm] Fix ambiguous errno error when importing WASILibc module"
This reverts commit 164ec0adaa.
2024-08-10 13:29:48 +00:00
Alastair Houghton
a95b69cdb8 Merge pull request #75709 from al45tair/eng/PR-132710670
[Build][Backtracing] Make sure the target for OS X is at least 10.14.4.
2024-08-09 18:48:21 +01:00
Guillaume Lessard
79bf5d51ca Merge pull request #75782 from glessard/rdar133343460-incorrectly-sendable
[stdlib] fix sendability of ManagedBufferPointer
2024-08-08 16:28:19 -07:00
Kuba (Brecka) Mracek
f9631e121c Merge pull request #75768 from kubamracek/embedded-string-switch
[embedded] Add StringSwitch.swift to the embedded stdlib
2024-08-08 15:28:22 -07:00
Guillaume Lessard
f9eb3223fe [stdlib] mark ManagedBufferPointer non-Sendable 2024-08-08 11:26:30 -07:00
Alex Martini
906efcbe93 Merge pull request #75625 from amartini51/param_132944086
Match parameter names in documentation to declaration

Fixes: rdar://132944086
2024-08-08 09:22:11 -07:00
Kuba Mracek
3c9f1ebb55 [embedded] Add StringSwitch.swift to the embedded stdlib 2024-08-07 21:37:01 -07:00
Alex Martini
d0d15167d3 Add missing "parameters" directive
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2024-08-07 11:07:54 -07:00
Yuta Saito
164ec0adaa [wasm] Fix ambiguous errno error when importing WASILibc module
This commit fixes an ambiguous `errno` error when importing WASILibc
module and SwiftWASILibc Clang module.

The error is caused by the fact that we define a shim for `errno` in
`Platform.swift` file, but wasi-libc defines `errno` in a way
ClangImporter can understand. We don't need to define shims for it,
otherwise we get two candidates for `errno` identifier.
2024-08-07 04:28:29 +00:00
Guillaume Lessard
29a4b8abff Merge pull request #75622 from glessard/rdar132941798-aEIC-private-consternation 2024-08-06 20:31:04 -07:00
Richard L Zarth III
e2c9541537 Allow TaskGroup's ChildTaskResult Type To Be Inferred (#74517)
Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
2024-08-07 11:11:33 +09:00
Alex Lorenz
b62eafd866 [windows] split out complex module from ucrt module, to allow new swift-foundation to import ucrt when C++ interoperability is enabled
Fixes https://github.com/swiftlang/swift/issues/75691
2024-08-06 11:33:03 -07:00
Alastair Houghton
02f87e3d8e [Build][Backtracing] Make sure the deployment target for OS X is over 10.14.4.
We need to make sure that we build swift-backtrace with a deployment target
newer than 10.14.4 in order that we get linked against
`/usr/lib/swift/libswiftCore.dylib` rather than using an `@rpath`-based
path.

If we fail to do that, dyld becomes confused and we end up crashing with
weird errors about missing method implementations on `Swift.__StringStorage`.

To make this work, add support for `DEPLOYMENT_VERSION_*` in the
`add_swift_target_executable()` CMake function.  And since I spotted a bug
in it, fix the existing support in `add_swift_target_library()` while I'm
there.

rdar://132710670
2024-08-06 15:03:01 +01:00
Andrew Kaster
65cd7e4ea3 fix centos7 build (hopefully) 2024-08-05 09:06:39 -06:00
Mike Ash
66303f6140 Merge pull request #75643 from mikeash/mangled-name-verification-null-check
[Runtime] Check for NULL demangling when verifying mangled name roundtrips.
2024-08-05 10:39:09 -04:00
Yuta Saito
34588acedb Merge pull request #75671 from kateinoigakukun/yt/add-alias-errno-const
[wasm] Add shims for aliased errno constants in WASILibc overlay
2024-08-05 18:45:16 +09:00
Yuta Saito
650e90a2b0 [Runtime] Repair build of getenv mode in EnvironmentVariables.cpp
Follow-up fix to 4b3a197dc2
2024-08-03 08:36:36 +00:00
Yuta Saito
65f9badbcd [wasm] Add shims for aliased errno constants in WASILibc overlay
We provide shims for errno constants in WASILibc overlay since
wasi-libc's errno.h defines those constants in a way that cannot be
imported by ClangImporter.
However, some errno constants are aliased in wasi-libc, and we didn't
provided shims for them. This patch adds those missing shims.
2024-08-03 07:51:49 +00:00
Andrew Kaster
fd41d2601f [cxx-interop] Disable c++ execution header with libstdcxx versions >= 11
Workaround for https://github.com/swiftlang/swift/issues/75661
2024-08-02 17:04:20 -06:00
Allan Shortlidge
65bf2d04cd Merge pull request #75646 from tshortli/zippered-os-version-at-least-or-variant-at-least
stdlib: Add runtime support for zippered availability checks
2024-08-02 16:03:49 -07:00
Mike Ash
5e15d8a6f1 Merge pull request #75376 from mikeash/libprespecialize-descriptor-map
[Runtime] Support type descriptor map in LibPrespecialized.
2024-08-02 16:25:11 -04:00
Allan Shortlidge
41fad31e64 stdlib: Add runtime support for zippered availability checks.
Now that `__isPlatformOrVariantPlatformVersionAtLeast()` is available in
upstream LLVM, the implementation of the zippered variant of the OS version
check utility can use the `targetOSVersionOrVariantOSVersionAtLeast` builtin
safely.

Resolves rdar://103960437.
2024-08-02 10:25:40 -07:00
Mike Ash
1d2ea6f949 [Runtime] Check for NULL demangling when verifying mangled name roundtrips.
_swift_buildDemanglingForMetadata can fail, so check for NULL and warn about it instead of crashing.
2024-08-02 11:26:57 -04:00
Konrad `ktoso` Malawski
f300164acc [Concurrency] Improve crash message on continuation misuse (#75613) 2024-08-02 00:46:45 -07:00
Ben Rimmington
28e1fdf919 [stdlib] Remove _FixedArray16 from GroupInfo.json (#75631) 2024-08-01 19:54:09 -07:00