Skip to content

Commit 4c1c8ed

Browse files
committed
Separate CMake option for "build concurrency lib" and "import concurrency lib"
The CMake option `SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY` was originally meant to imply that we should build the _Concurrency module, which it still does. However, to support minimal stdlib builds, it also became a way to configure the compiler to avoid implicitly importing the _Concurrency module. However, we build configurations of Swift where we want the implicit import but don't want to build the _Concurrency library. Use a new, different option (`SWIFT_IMPLICIT_CONCURRENCY_IMPORT`) for the "implicit import" behavior within the compiler, which defaults to "true", and disable that for minimal stdlib builds. Fixes rdar://78544947.
1 parent 2b550b7 commit 4c1c8ed

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,12 @@ option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
414414
"Enable experimental Swift differentiable programming features"
415415
FALSE)
416416

417+
option(SWIFT_IMPLICIT_CONCURRENCY_IMPORT
418+
"Implicitly import the Swift concurrency module"
419+
TRUE)
420+
417421
option(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
418-
"Enable experimental Swift concurrency model"
422+
"Enable build of the Swift concurrency module"
419423
FALSE)
420424

421425
option(SWIFT_ENABLE_DISPATCH

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ namespace swift {
272272

273273
/// Disable the implicit import of the _Concurrency module.
274274
bool DisableImplicitConcurrencyModuleImport =
275-
!SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY;
275+
!SWIFT_IMPLICIT_CONCURRENCY_IMPORT;
276276

277277
/// Should we check the target OSs of serialized modules to see that they're
278278
/// new enough?

include/swift/Config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
#cmakedefine HAVE_PROC_PID_RUSAGE 1
1010

11-
#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
11+
#cmakedefine01 SWIFT_IMPLICIT_CONCURRENCY_IMPORT
1212

1313
#endif // SWIFT_CONFIG_H

utils/build-presets.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2413,7 +2413,7 @@ swift-enable-compatibility-overrides=0
24132413
swift-runtime-macho-no-dyld=1
24142414
swift-stdlib-single-threaded-runtime=1
24152415
swift-stdlib-os-versioning=0
2416-
extra-cmake-options=-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE
2416+
extra-cmake-options=-DSWIFT_ENABLE_DISPATCH:BOOL=FALSE -DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL=FALSE
24172417

24182418
[preset: stdlib_S_standalone_minimal_macho_x86_64,build]
24192419
mixin-preset=

0 commit comments

Comments
 (0)