From 4e0dc5203a3a5b11bdf0da4f22f39b2dbe29c8fa Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 6 Feb 2024 21:08:32 +0000 Subject: [PATCH] arch: x86_64: Disable dead code detection for embedded struct These structs directly embed another struct and then implement ByteValued on that struct to implement ByteValued for the inner struct. As such the inner struct is never directly accessed so to avoid the dead code analysis mark this as allowed. Beta clippy fix: warning: field `0` is never read --> arch/src/x86_64/mod.rs:129:32 | 129 | struct MemmapTableEntryWrapper(hvm_memmap_table_entry); | ----------------------- ^^^^^^^^^^^^^^^^^^^^^^ | | | field in this struct | = note: `MemmapTableEntryWrapper` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 129 | struct MemmapTableEntryWrapper(()); | Signed-off-by: Rob Bradford --- arch/src/x86_64/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index 08641af17..3fc7f26d9 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -124,11 +124,11 @@ impl SgxEpcRegion { #[derive(Copy, Clone, Default)] struct StartInfoWrapper(hvm_start_info); -#[cfg_attr(fuzzing, allow(dead_code))] +#[allow(dead_code)] #[derive(Copy, Clone, Default)] struct MemmapTableEntryWrapper(hvm_memmap_table_entry); -#[cfg_attr(fuzzing, allow(dead_code))] +#[allow(dead_code)] #[derive(Copy, Clone, Default)] struct ModlistEntryWrapper(hvm_modlist_entry); @@ -144,7 +144,7 @@ unsafe impl ByteValued for ModlistEntryWrapper {} // * the type that is implementing the trait is foreign or // * all of the parameters being passed to the trait (if there are any) are also foreign // is prohibited. -#[cfg_attr(fuzzing, allow(dead_code))] +#[allow(dead_code)] #[derive(Copy, Clone, Default)] struct BootParamsWrapper(boot_params);