From e041defa67f1aab9f6c753f0ec9ecbf7024b406a Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 8 Jan 2024 16:53:11 +0000 Subject: [PATCH] fuzz: Fix warnings for unused arch code Under the fuzzer this code appears dead: error: field `0` is never read --> /home/rob/src/cloud-hypervisor/arch/src/x86_64/mod.rs:128:32 | 128 | 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: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 128 | struct MemmapTableEntryWrapper(()); | ~~ Signed-off-by: Rob Bradford --- arch/src/x86_64/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index 995ed19bc..aa6945d99 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -124,9 +124,11 @@ impl SgxEpcRegion { #[derive(Copy, Clone, Default)] struct StartInfoWrapper(hvm_start_info); +#[cfg_attr(fuzzing, allow(dead_code))] #[derive(Copy, Clone, Default)] struct MemmapTableEntryWrapper(hvm_memmap_table_entry); +#[cfg_attr(fuzzing, allow(dead_code))] #[derive(Copy, Clone, Default)] struct ModlistEntryWrapper(hvm_modlist_entry); @@ -142,6 +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))] #[derive(Copy, Clone, Default)] struct BootParamsWrapper(boot_params);