@@ -345,25 +345,40 @@ bool __swift_bincompat_useLegacyNonCrashingExecutorChecks() {
345
345
#endif
346
346
}
347
347
348
+ // Shimming call to Swift runtime because Swift Embedded does not have
349
+ // these symbols defined.
350
+ const char *__swift_runtime_env_useLegacyNonCrashingExecutorChecks () {
351
+ // Potentially, override the platform detected mode, primarily used in tests.
352
+ #if SWIFT_STDLIB_HAS_ENVIRON && !SWIFT_CONCURRENCY_EMBEDDED
353
+ return swift::runtime::environment::
354
+ concurrencyIsCurrentExecutorLegacyModeOverride ();
355
+ #else
356
+ return nullptr ;
357
+ #endif
358
+ }
359
+
360
+ #pragma clang diagnostic push
361
+ #pragma ide diagnostic ignored "ConstantConditionsOC"
348
362
// Done this way because of the interaction with the initial value of
349
363
// 'unexpectedExecutorLogLevel'
350
364
bool swift_bincompat_useLegacyNonCrashingExecutorChecks () {
351
365
bool legacyMode = __swift_bincompat_useLegacyNonCrashingExecutorChecks ();
352
366
353
367
// Potentially, override the platform detected mode, primarily used in tests.
354
- # if SWIFT_STDLIB_HAS_ENVIRON
355
- if ( const char *modeStr = runtime::environment::
356
- concurrencyIsCurrentExecutorLegacyModeOverride ()) {
357
- if ( strcmp (modeStr, " nocrash " ) == 0 || strcmp (modeStr, " legacy" ) == 0 ) {
368
+ if ( const char *modeStr =
369
+ __swift_runtime_env_useLegacyNonCrashingExecutorChecks ()) {
370
+ if ( strcmp (modeStr, " nocrash " ) == 0 ||
371
+ strcmp (modeStr, " legacy" ) == 0 ) {
358
372
return true ;
359
- } else if (strcmp (modeStr, " crash" ) == 0 || strcmp (modeStr, " swift6" ) == 0 ) {
373
+ } else if (strcmp (modeStr, " crash" ) == 0 ||
374
+ strcmp (modeStr, " swift6" ) == 0 ) {
360
375
return false ; // don't use the legacy mode
361
376
} // else, just use the platform detected mode
362
377
} // no override, use the default mode
363
- #endif // SWIFT_STDLIB_HAS_ENVIRON
364
378
365
379
return legacyMode;
366
380
}
381
+ #pragma clang diagnostic pop
367
382
368
383
// Check override of executor checking mode.
369
384
static void checkIsCurrentExecutorMode (void *context) {
0 commit comments