fix(windows-drivers): parse the iddcx bindgen as C++ (clears struct-tag)
apple / swift (push) Failing after 2s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 21s
windows-drivers / driver-build (push) Failing after 58s
windows-host / package (push) Successful in 5m20s
ci / rust (push) Successful in 1m18s
ci / web (push) Successful in 40s
android / android (push) Successful in 3m48s
ci / docs-site (push) Successful in 52s
deb / build-publish (push) Successful in 3m19s
decky / build-publish (push) Successful in 11s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 6s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 5s
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 4s
ci / bench (push) Successful in 4m50s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m57s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m48s
docker / deploy-docs (push) Successful in 17s
apple / swift (push) Failing after 2s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 21s
windows-drivers / driver-build (push) Failing after 58s
windows-host / package (push) Successful in 5m20s
ci / rust (push) Successful in 1m18s
ci / web (push) Successful in 40s
android / android (push) Successful in 3m48s
ci / docs-site (push) Successful in 52s
deb / build-publish (push) Successful in 3m19s
decky / build-publish (push) Successful in 11s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 6s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 5s
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 4s
ci / bench (push) Successful in 4m50s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m57s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m48s
docker / deploy-docs (push) Successful in 17s
Direct clang test on the box proved IddCx.h parses with 0 errors as C++ but fails as C (wdk_default has no --language=c++) — the IDARG_* typedef names hit "must use struct tag" in C mode. Fix generate_iddcx: --language=c++ + keep -DIDD_STUB + allowlist_recursively(false) + full codegen, so it emits ONLY IddCx items (structs, the IddFunctions table enums, DDI fn-ptr typedefs) and references WDF/Win/DXGI types from wdk-sys via `use crate::types::*` (no re-emission, no blocklist). Reverted the ENABLED_API_SUBSETS Iddcx entry (it wrongly pulled IddCx into the C-mode constants/types passes). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-12
@@ -145,8 +145,6 @@ const ENABLED_API_SUBSETS: &[ApiSubset] = &[
|
|||||||
ApiSubset::Storage,
|
ApiSubset::Storage,
|
||||||
#[cfg(feature = "usb")]
|
#[cfg(feature = "usb")]
|
||||||
ApiSubset::Usb,
|
ApiSubset::Usb,
|
||||||
#[cfg(feature = "iddcx")]
|
|
||||||
ApiSubset::Iddcx,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
type GenerateFn = fn(&Path, &Config) -> Result<(), ConfigError>;
|
type GenerateFn = fn(&Path, &Config) -> Result<(), ConfigError>;
|
||||||
@@ -356,18 +354,20 @@ fn generate_iddcx(out_path: &Path, config: &Config) -> Result<(), ConfigError> {
|
|||||||
|
|
||||||
let bindgen_builder = {
|
let bindgen_builder = {
|
||||||
bindgen::Builder::wdk_default(config)?
|
bindgen::Builder::wdk_default(config)?
|
||||||
// IddCx headers MUST be in STUB mode (function-table dispatch): IddCxFuncEnum.h otherwise
|
// IddCx.h MUST be parsed as C++: under wdk-sys's default C mode the IDARG_* typedef names
|
||||||
// errors "IDDCX_VERSION_MAJOR is not defined", cascading into "must use 'struct' tag" on the
|
// hit clang's "must use 'struct' tag" (verified: IddCx.h parses with 0 errors as C++, fails
|
||||||
// IDARG_* types (their version-gated typedefs get skipped). `#define IDD_STUB` is exactly
|
// as C). `IDD_STUB` puts IddCxFuncEnum.h in table-dispatch mode (else its `#error
|
||||||
// what the proven wdf-umdf oracle uses. Do NOT add WDF_STUB — wdk-sys parses wdf.h
|
// IDDCX_VERSION_MAJOR is not defined` fires — it's inside `#ifndef IDD_STUB`). Matches the
|
||||||
// non-stubbed, and stubbing it only here would desync the WDF types the iddcx module resolves
|
// proven wdf-umdf oracle's `--language=c++` + `#define IDD_STUB`. NOT WDF_STUB (wdk-sys
|
||||||
// against, breaking type-identity.
|
// parses wdf.h non-stubbed; stubbing only here would desync WDF type-identity).
|
||||||
|
.clang_arg("--language=c++")
|
||||||
.clang_arg("-DIDD_STUB")
|
.clang_arg("-DIDD_STUB")
|
||||||
.with_codegen_config((CodegenConfig::TYPES | CodegenConfig::VARS).complement())
|
// 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,
|
||||||
|
// no fragile blocklist). Full codegen (no .complement()) so the IDARG_* structs are emitted.
|
||||||
|
.allowlist_recursively(false)
|
||||||
.header_contents("iddcx-input.h", &header_contents)
|
.header_contents("iddcx-input.h", &header_contents)
|
||||||
// Allowlist by the "iddcx" path component (separator-agnostic) so ONLY IddCx items are
|
|
||||||
// emitted; the WDF/Win/DXGI types they reference RESOLVE to the shared base/wdf bindings
|
|
||||||
// instead of being redefined.
|
|
||||||
.allowlist_file("(?i).*iddcx.*")
|
.allowlist_file("(?i).*iddcx.*")
|
||||||
};
|
};
|
||||||
trace!(bindgen_builder = ?bindgen_builder);
|
trace!(bindgen_builder = ?bindgen_builder);
|
||||||
|
|||||||
Reference in New Issue
Block a user