linux/rust/macros
Gary Guo 779f6e3e1c rust: macros: support #[cfg] properly in #[vtable] macro.
Currently, we generate `HAS_` constants as long as the definition exists in
the source, regardless if it is cfg-ed out or not.

Currently, uses of `#[cfg]` present in both trait and impl, so it is not a
problem; however if only the impl side uses `#[cfg]` then `HAS_` constants
will incorrectly be true while it shouldnt't.

With `syn` support, we can now implement `#[cfg]` handling properly by
propagating the `#[cfg]` attributes to the constants.

Signed-off-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260113170529.2240744-1-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-01-28 13:44:17 +01:00
..
concat_idents.rs rust: macros: convert concat_idents! to use syn 2026-01-28 00:55:25 +01:00
export.rs rust: macros: convert #[export] to use syn 2026-01-28 00:55:25 +01:00
fmt.rs rust: macros: use quote! from vendored crate 2026-01-28 00:55:24 +01:00
helpers.rs rust: macros: support #[cfg] properly in #[vtable] macro. 2026-01-28 13:44:17 +01:00
kunit.rs rust: kunit: use pin_init::zeroed instead of custom null value 2026-01-28 13:44:17 +01:00
lib.rs rust: macros: convert #[kunit_tests] macro to use syn 2026-01-28 13:43:36 +01:00
module.rs rust: macros: rearrange #[doc(hidden)] in module! macro 2026-01-28 13:44:17 +01:00
paste.rs rust: macros: use quote! from vendored crate 2026-01-28 00:55:24 +01:00
vtable.rs rust: macros: support #[cfg] properly in #[vtable] macro. 2026-01-28 13:44:17 +01:00