Skip to content

Commit 2d96b24

Browse files
committed
Embedded: Suppress spurious unused result warnings.
The results of `swift_retain(object:)` and `swift_bridgeObjectRetain(object:)` should be discardable since it's typcial to not need the pointer returned from these calls. Suppresses unused result warnings that were generated previously.
1 parent 98951af commit 2d96b24

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/public/core/EmbeddedRuntime.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ func swift_isUniquelyReferenced_nonNull_native(object: UnsafeMutablePointer<Heap
307307
}
308308

309309
@_cdecl("swift_retain")
310+
@discardableResult
310311
public func swift_retain(object: Builtin.RawPointer) -> Builtin.RawPointer {
311312
if !isValidPointerForNativeRetain(object: object) { return object }
312313

@@ -335,6 +336,7 @@ func swift_retain_n_(object: UnsafeMutablePointer<HeapObject>, n: UInt32) -> Uns
335336
}
336337

337338
@_cdecl("swift_bridgeObjectRetain")
339+
@discardableResult
338340
public func swift_bridgeObjectRetain(object: Builtin.RawPointer) -> Builtin.RawPointer {
339341
return swift_bridgeObjectRetain_n(object: object, n: 1)
340342
}

0 commit comments

Comments
 (0)