[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.
This commit is contained in:
3405691582
2021-04-22 22:52:47 -04:00
parent a4e71aa819
commit 72d9503be0

View File

@@ -763,6 +763,10 @@ static bool shouldImportConcurrencyByDefault(const llvm::Triple &target) {
return true;
if (target.isOSLinux())
return true;
#if SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY
if (target.isOSOpenBSD())
return true;
#endif
return false;
}