fix(windows-drivers): translate iddcx enum repr ints (UINT in nested mods)
apple / swift (push) Failing after 1s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 17s
windows-drivers / driver-build (push) Successful in 1m3s
windows-host / package (push) Successful in 5m31s
ci / rust (push) Successful in 1m22s
android / android (push) Successful in 3m18s
ci / web (push) Successful in 40s
ci / docs-site (push) Successful in 54s
deb / build-publish (push) Successful in 3m22s
decky / build-publish (push) Successful in 10s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 4s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 4s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 3s
ci / bench (push) Successful in 4m48s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m35s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m34s
docker / deploy-docs (push) Has been cancelled

Last UINT errors were all `pub type Type = UINT;` inside bindgen enum modules
(pub mod _DXGI_X {..}) — the top-level UINT alias cannot reach nested modules. C++
parsing made bindgen keep the UINT typedef as the enum underlying repr (C mode
emits a primitive). translate_enum_integer_types(true) emits native u32 reprs, so
the enum modules are self-contained; struct-field UINT stays covered by the
src/iddcx.rs alias.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-24 15:01:22 +00:00
parent 2f7847ce9b
commit 6d8c7a5185
+6
View File
@@ -362,6 +362,12 @@ fn generate_iddcx(out_path: &Path, config: &Config) -> Result<(), ConfigError> {
// parses wdf.h non-stubbed; stubbing only here would desync WDF type-identity).
.clang_arg("--language=c++")
.clang_arg("-DIDD_STUB")
// Parsing as C++ makes bindgen preserve the `UINT` typedef as the underlying repr of the
// DXGI/OPM enums it emits as `pub mod _X { pub type Type = UINT; }` — and `UINT` isn't in
// scope inside those nested modules. Translate enum repr types to native Rust ints (u32) so
// the enum modules are self-contained. (Struct fields still use `UINT`, covered by the
// alias in src/iddcx.rs.)
.translate_enum_integer_types(true)
// Emit ONLY IddCx items (its types + the IddFunctions table enums + the DDI fn-pointer
// typedefs) and DON'T recurse into referenced WDF/Win/DXGI types — those resolve to wdk-sys's
// shared bindings via `use crate::types::*` in src/iddcx.rs (type-identity, no re-emission,