Skip to content

fix(signpost): gate signpost code on os.signpost availability - #1247

Closed
cristim wants to merge 1 commit into
OpenSwiftUIProject:mainfrom
cristim:rfc-signpost-gate
Closed

cristim wants to merge 1 commit into
OpenSwiftUIProject:mainfrom
cristim:rfc-signpost-gate

Conversation

@cristim

@cristim cristim commented Nov 4, 2026

Copy link
Copy Markdown

Summary

RFC, draft, unbuilt. Gate the signpost code on the modules it uses (os.signpost, os.log) instead of Darwin or os, so it compiles on Darwin-like SDKs that lack those submodules.

Verification

Run: the commit cherry-picks cleanly onto current main. Not run: no Swift, C or Objective-C compiler was available on the machine used, so this was not compiled and CI is the first real check.

CONTRIBUTING.md asks for an issue or discussion first for large work; this PR is a single small concern. Related RFC draft: #1246. Note: this also changes the condition on Apple platforms, where os.signpost is expected to be importable wherever Darwin was.

The signpost helpers were guarded by canImport(Darwin) or canImport(os), but
what they call lives in the os.signpost and os.log submodules. On Darwin-like
SDKs that provide Darwin but not those submodules the code does not compile.
Guard each use with the module it actually needs.

Note: this also changes the condition on Apple platforms, where
os.signpost is expected to be importable wherever Darwin was.

(cherry picked from commit b481b0b)
@cristim

cristim commented Nov 4, 2026

Copy link
Copy Markdown
Author

Cold review: code clean (guards balanced, matches the useLocalDeps style). Unverified risk noted by the reviewer: older compilers may check only the top-level module in canImport(A.B), in which case #1247 would have no effect on the target SDK. Not compiled.


package struct Signpost {
#if canImport(Darwin) && !OPENSWIFTUI_SWIFT_LOG
#if canImport(os.signpost) && !OPENSWIFTUI_SWIFT_LOG

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. OSSignposter is not in os.signpost. Change if canImport Darwin to canImport os LGTM.

  2. We do not intent to support older SDK compiler. You can leave those changes in your fork.

@Kyle-Ye Kyle-Ye closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants