Skip to content

Commit b9a1ad2

Browse files
authored
Merge pull request swiftlang#21353 from compnerd/_setjmp
2 parents faad92d + df1bcb7 commit b9a1ad2

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
Name: VisualC
3+
Functions:
4+
- Name: _setjmp
5+
Availability: nonswift
6+
AvailabilityMsg: 'Functions that return more than once are unavailable in swift'
7+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-typecheck-verify-swift
2+
// REQUIRES: OS=windows-msvc
3+
4+
import MSVCRT
5+
typealias JumpBuffer = _JBTYPE
6+
7+
func test_unavailable_returns_twice_function() {
8+
var x: JumpBuffer
9+
_ = _setjmp(&x) // expected-error {{'_setjmp' is unavailable in Swift: Functions that return more than once are unavailable in swift}}
10+
}
11+

test/ClangImporter/availability_returns_twice.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
// RUN: %target-typecheck-verify-swift
2+
// UNSUPPORTED: OS=windows-msvc
23

34
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
45
import Darwin
56
typealias JumpBuffer = Int32
67
#elseif os(Android) || os(Cygwin) || os(FreeBSD) || os(Linux)
78
import Glibc
89
typealias JumpBuffer = jmp_buf
9-
#elseif os(Windows)
10-
import MSVCRT
11-
typealias JumpBuffer = jmp_buf
1210
#endif
1311

1412
func test_unavailable_returns_twice_function() {

0 commit comments

Comments
 (0)