Skip to content

Commit bc4b94c

Browse files
committed
remove HAVE_MACH guards around munmap destructor code and add missing block declaration
1 parent dedb448 commit bc4b94c

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/data.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ const dispatch_block_t _dispatch_data_destructor_none = ^{
108108
DISPATCH_INTERNAL_CRASH(0, "none destructor called");
109109
};
110110

111+
const dispatch_block_t _dispatch_data_destructor_munmap = ^{
112+
DISPATCH_INTERNAL_CRASH(0, "munmap destructor called");
113+
};
114+
111115
const dispatch_block_t _dispatch_data_destructor_vm_deallocate = ^{
112116
DISPATCH_INTERNAL_CRASH(0, "vmdeallocate destructor called");
113117
};

src/swift/Data.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,18 @@ public struct DispatchData : RandomAccessCollection {
2424
/// Use `free`
2525
case free
2626

27-
#if HAVE_MACH
2827
/// Use `munmap`
2928
case unmap
30-
#endif
3129

3230
/// A custom deallocator
3331
case custom(DispatchQueue?, @convention(block) () -> Void)
3432

3533
private var _deallocator: (DispatchQueue?, @convention(block) () -> Void) {
36-
#if HAVE_MACH
3734
switch self {
3835
case .free: return (nil, _dispatch_data_destructor_free())
3936
case .unmap: return (nil, _dispatch_data_destructor_munmap())
4037
case .custom(let q, let b): return (q, b)
4138
}
42-
#else
43-
switch self {
44-
case .free: return (nil, _dispatch_data_destructor_free())
45-
case .custom(let q, let b): return (q, b)
46-
}
47-
#endif
4839
}
4940
}
5041
#endif
@@ -279,10 +270,8 @@ internal func _swift_dispatch_data_empty() -> dispatch_data_t
279270
@_silgen_name("_swift_dispatch_data_destructor_free")
280271
internal func _dispatch_data_destructor_free() -> _DispatchBlock
281272

282-
#if HAVE_MACH
283273
@_silgen_name("_swift_dispatch_data_destructor_munmap")
284274
internal func _dispatch_data_destructor_munmap() -> _DispatchBlock
285-
#endif
286275

287276
@_silgen_name("_swift_dispatch_data_destructor_default")
288277
internal func _dispatch_data_destructor_default() -> _DispatchBlock

src/swift/DispatchStubs.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,11 @@ _swift_dispatch_data_destructor_free(void) {
9393
return _dispatch_data_destructor_free;
9494
}
9595

96-
#if HAVE_MACH
9796
SWIFT_CC(swift) DISPATCH_RUNTIME_STDLIB_INTERFACE
9897
extern "C" dispatch_block_t
9998
_swift_dispatch_data_destructor_munmap(void) {
10099
return _dispatch_data_destructor_munmap;
101100
}
102-
#endif
103101

104102
SWIFT_CC(swift) DISPATCH_RUNTIME_STDLIB_INTERFACE
105103
extern "C" dispatch_block_t

0 commit comments

Comments
 (0)