Home
last modified time | relevance | path

Searched hist:b9b88be046a92a43d70badb340cac9ffd9695dcb (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/rust/kernel/init/
H A Dmacros.rsdiff b9b88be046a92a43d70badb340cac9ffd9695dcb Mon Aug 14 03:46:55 CDT 2023 Benno Lossin <benno.lossin@proton.me> rust: init: wrap type checking struct initializers in a closure

In the implementation of the init macros there is a `if false` statement
that type checks the initializer to ensure every field is initialized.
Since the next patch has a stack variable to store the struct, the
function might allocate too much memory on debug builds. Putting the
struct into a closure that is never executed ensures that even in debug
builds no stack overflow error is caused. In release builds this was not
a problem since the code was optimized away due to the `if false`.

Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20230814084602.25699-6-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>