Skip to content

Commit

Permalink
macros/class: Propagate cfg annotations to COM class methods
Browse files Browse the repository at this point in the history
We have a very peculiar workaround for DXC (pending upstream fix
[microsoft/DirectXShaderCompiler#3793]) that requires us to
conditionally provide function implementations for extra vtable
"spacers": https://github.com/Traverse-Research/hassle-rs/blob/f5a090c70bbcf66f3bafd3d549716a414e873838/src/wrapper.rs#L130-L139.
The spacers are conditionally defined in:
https://github.com/Traverse-Research/hassle-rs/blob/f5a090c70bbcf66f3bafd3d549716a414e873838/src/unknown.rs.

These need to be forwarded otherwise the initialization of these vtable
members will happen unconditionally even when they don't exist:
https://github.com/Traverse-Research/hassle-rs/actions/runs/1777800733

Fixes microsoft#166
[microsoft/DirectXShaderCompiler#3793]: microsoft/DirectXShaderCompiler#3793
  • Loading branch information
MarijnS95 committed Mar 28, 2023
1 parent 957bafa commit 07148b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions macros/support/src/class/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ impl Interface {
}
};
let field_name = Ident::new(&crate::utils::snake_to_camel(&original_name.to_string()), proc_macro2::Span::call_site());
let attrs = &m.item.attrs;
quote! {
#(#attrs)*
#field_name: {
#method
#name
Expand Down
1 change: 0 additions & 1 deletion src/production.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod class;
#[cfg(windows)]
#[doc(hidden)]
#[cfg(windows)]
pub mod registration;
Expand Down

0 comments on commit 07148b2

Please sign in to comment.