Skip to content

Commit 72d9503

Browse files
committed
[concurrency] Import module on OpenBSD if enabled.
Tests are written under the assumption that since they are conditioned on the concurrency feature, the explicit `_Concurrency` module import is not necessary since it is imported implicitly if concurrency is enabled. However, this is not the case; the module import is only included implictly on selected targets. It may very well be ideal to import the `_Concurrency` module implicitly when `SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY` is true and therefore solve the incorrect assumption, however, that decision is something that is above my pay grade. Some guidance on this is welcome. That being said, on OpenBSD, Dispatch is currently unsupported upstream but there is a draft PR to add this support (559). This means that even while we have draft Dispatch support, all the Concurrency tests fail because they do not import `_Concurrency`, but we cannot unconditionally support concurrency until Dispatch is supported upstream. Therefore, we especially need to support both cases. So instead, on OpenBSD, if the concurrency feature is enabled, import the module implicitly, otherwise, do not. This lets us run the tests and get a good signal that concurrency features are working with the draft Dispatch support, while avoiding problems when building with the documented configuration that disables Dispatch, and therefore, disables concurrency.
1 parent a4e71aa commit 72d9503

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ static bool shouldImportConcurrencyByDefault(const llvm::Triple &target) {
763763
return true;
764764
if (target.isOSLinux())
765765
return true;
766+
#if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
767+
if (target.isOSOpenBSD())
768+
return true;
769+
#endif
766770
return false;
767771
}
768772

0 commit comments

Comments
 (0)