Skip to content

windows-clang normalize unmerged scalar signatures - #4763

Merged
Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
clang-merged-scalars
Jul 30, 2026
Merged

Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
clang-merged-scalars

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the windows-metadata cross-architecture merge logic to normalize certain unmanaged callback (delegate) signatures to native-sized integers when there is explicit native-sized evidence (isize/usize) in at least one architecture. This reduces arch-split surface area for callback typedefs like FARPROC/NEARPROC/PROC, and regenerates the downstream metadata and bindings accordingly.

Changes:

  • Add a targeted merge reconciliation for unmanaged callback Invoke signatures when fixed-width integers match pointer width and at least one arch uses isize/usize.
  • Regenerate Win32 minwindef metadata + windows / windows-sys / windows-core bindings to remove x86-specific fixed-width callback variants.
  • Document the new merge rule and add tests covering acceptance and rejection cases.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
metadata/win32/minwindef.rdl Removes per-arch callback signatures for FARPROC/NEARPROC/PROC in favor of a single native-sized signature.
docs/crates/windows-metadata.md Documents the new unmanaged-callback native-sized reconciliation in the arch merge rules.
docs/crates/windows-clang.md Updates the issue findings table to reflect that FARPROC normalization is now handled by the merger.
crates/tests/libs/metadata/tests/merge.rs Adds unit tests validating the new reconciliation behavior and several rejection conditions.
crates/libs/windows/src/Windows/Win32/minwindef/mod.rs Regenerates the windows crate projection so callback typedefs no longer vary by arch.
crates/libs/sys/src/Windows/Win32/minwindef/mod.rs Regenerates the windows-sys projection so callback typedefs no longer vary by arch.
crates/libs/metadata/src/merge/mod.rs Implements the callback-signature normalization and signature override plumbing when writing merged winmds.
crates/libs/core/src/imp/bindings.rs Regenerates core bindings (FARPROC) to match the merged metadata output.

Comment thread docs/crates/windows-metadata.md Outdated
Comment on lines +53 to +58
Unmanaged callbacks have one narrow semantic reconciliation before that split. If at least one
architecture explicitly uses `isize` or `usize` and every other copy uses the same native-sized
integer for its architecture (`i32`/`u32` on x86, `i64`/`u64` on x64 or arm64), the callback keeps
the native-sized type and becomes arch-neutral. This handles SDK declarations such as `FARPROC`,
whose return is spelled `INT_PTR` on 64-bit but historical `int` on x86. A plain `i32`/`i64` pair
does not qualify: the explicit native-sized spelling is required as semantic evidence.
Comment thread crates/tests/libs/metadata/tests/merge.rs
@kennykerr
Kenny Kerr (kennykerr) merged commit ccbed80 into master Jul 30, 2026
35 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the clang-merged-scalars branch July 30, 2026 16:13
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