From fdf87d8827aa14c16a9cfc4ba97210a2a7c6f4dd Mon Sep 17 00:00:00 2001 From: Zach Reizner Date: Thu, 11 Mar 2021 07:54:35 -0800 Subject: [PATCH] update Cargo.lock and conditional compile certain modules This change is to cleanup some dead_code warnings that appear if certain features aren't enabled. This also updates the Cargo.lock when changed due to zeroize being added to libchromeos-rs. TEST=cargo check --all-features BUG=None Change-Id: I5347b584a7426dc37f3933b1e907b23a71145749 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2753128 Reviewed-by: Allen Webb Reviewed-by: Gurchetan Singh Reviewed-by: Daniel Verkamp Tested-by: kokoro Tested-by: Zach Reizner Commit-Queue: Zach Reizner --- Cargo.lock | 34 ++++++++++++++++++++++++++++++ devices/src/virtio/gpu/mod.rs | 4 +++- gpu_display/src/lib.rs | 1 + rutabaga_gfx/src/lib.rs | 1 + rutabaga_gfx/src/renderer_utils.rs | 2 +- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d9e769950..5436e66700 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -564,6 +564,7 @@ dependencies = [ "log", "protobuf", "thiserror", + "zeroize", ] [[package]] @@ -919,6 +920,18 @@ dependencies = [ name = "sync" version = "0.1.0" +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + [[package]] name = "sys_util" version = "0.1.0" @@ -1094,3 +1107,24 @@ dependencies = [ "vm_control", "vm_memory", ] + +[[package]] +name = "zeroize" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index a79bb43c1f..688a4ffd8a 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -970,8 +970,10 @@ impl Gpu { let num_capsets = match self.rutabaga_component { RutabagaComponentType::Rutabaga2D => 0, _ => { + let mut num_capsets = 0; + // Cross-domain (like virtio_wl with llvmpipe) is always available. - let mut num_capsets = 1; + num_capsets += 1; // Three capsets for virgl_renderer #[cfg(feature = "virgl_renderer")] diff --git a/gpu_display/src/lib.rs b/gpu_display/src/lib.rs index 0ffae8792e..1f8ea0f13e 100644 --- a/gpu_display/src/lib.rs +++ b/gpu_display/src/lib.rs @@ -15,6 +15,7 @@ mod gpu_display_stub; mod gpu_display_wl; #[cfg(feature = "x")] mod gpu_display_x; +#[cfg(feature = "x")] mod keycode_converter; pub use event_device::{EventDevice, EventDeviceKind}; diff --git a/rutabaga_gfx/src/lib.rs b/rutabaga_gfx/src/lib.rs index 40c131ba37..dc99fa1590 100644 --- a/rutabaga_gfx/src/lib.rs +++ b/rutabaga_gfx/src/lib.rs @@ -10,6 +10,7 @@ mod generated; mod gfxstream; #[macro_use] mod macros; +#[cfg(any(feature = "gfxstream", feature = "virgl_renderer"))] mod renderer_utils; mod rutabaga_2d; mod rutabaga_core; diff --git a/rutabaga_gfx/src/renderer_utils.rs b/rutabaga_gfx/src/renderer_utils.rs index 9b3726437f..94a271a725 100644 --- a/rutabaga_gfx/src/renderer_utils.rs +++ b/rutabaga_gfx/src/renderer_utils.rs @@ -30,7 +30,7 @@ pub struct VirglBox { * -o vsnprintf.rs */ -#[allow(dead_code, non_snake_case, non_camel_case_types)] +#[allow(non_snake_case, non_camel_case_types)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] extern "C" { pub fn vsnprintf(