From 640edfdd01cabac2d20ae383d77a7aee9a9ca38f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 31 Oct 2019 01:15:15 -0700 Subject: [PATCH] Cfg away debug::print_module when not used --- runtime/src/lib.rs | 1 + src/exec.rs | 5 ++--- src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 9187e91..1a31c21 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -116,6 +116,7 @@ pub fn module_imports<'a>( } /// List module exports with their types +#[cfg(any(feature = "test", watt_debug))] pub fn module_exports<'a>( module: &'a ast::Module, ) -> impl Iterator + 'a { diff --git a/src/exec.rs b/src/exec.rs index 36eb203..e8179f4 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -49,9 +49,8 @@ fn _proc_macro(fun: &str, inputs: Vec, wasm: &[u8]) -> TokenStream let cursor = Cursor::new(wasm); let module = decode_module(cursor).unwrap(); - if cfg!(watt_debug) { - crate::debug::print_module(&module); - } + #[cfg(watt_debug)] + crate::debug::print_module(&module); let mut store = init_store(); let extern_vals = import::extern_vals(&module, &mut store); diff --git a/src/lib.rs b/src/lib.rs index 6b1f0b6..bd7c0a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -194,7 +194,7 @@ mod exec; mod import; mod sym; -#[cfg(not(jit))] +#[cfg(all(watt_debug, not(jit)))] mod debug; use proc_macro::TokenStream;