Skip to content

Commit 48503bf

Browse files
committed
[shims] ensure that _SwiftConcurrency has the same Swift interface regardless of whether C++ interop is enabled
This ensures that a module built from Swift interface file (and as such interop is disabled), that references 'exit' (from _SwiftConcurrencyShims module) can resolve the module reference to 'exit' even when it's being imported when interop is enabled (and thus it loads a different underlying _SwiftConcurrencyShims).
1 parent 5bb6f79 commit 48503bf

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

stdlib/public/SwiftShims/swift/shims/_SwiftConcurrency.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ typedef struct _SwiftContext {
2525
struct _SwiftContext *parentContext;
2626
} _SwiftContext;
2727

28-
void exit(int);
29-
30-
#define EXIT_SUCCESS 0
31-
3228
#ifdef __cplusplus
3329
} // extern "C"
3430
} // namespace swift
3531
#endif
3632

33+
#ifdef __cplusplus
34+
extern "C" [[noreturn]]
35+
#endif
36+
void exit(int);
37+
38+
#define EXIT_SUCCESS 0
39+
3740
#endif // SWIFT_CONCURRENCY_H
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=_SwiftConcurrencyShims -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
2+
// RUN: %target-swift-ide-test -print-module -module-to-print=_SwiftConcurrencyShims -source-filename=x | %FileCheck %s
3+
4+
// REQUIRES: concurrency
5+
6+
// Ensure that _SwiftConcurrencyShims defines the same `exit` regardless of whether
7+
// C++ interoperability is enabled.
8+
9+
// CHECK: func exit(_: Int32) -> Never
10+
// CHECK: var EXIT_SUCCESS: Int32 { get }

0 commit comments

Comments
 (0)