diff --git a/lib/emscripten/src/macros.rs b/lib/emscripten/src/macros.rs index fe2bd1a7f..8b1378917 100644 --- a/lib/emscripten/src/macros.rs +++ b/lib/emscripten/src/macros.rs @@ -1,4 +1 @@ -macro_rules! debug { - ($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) }); - ($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*) }); -} + diff --git a/lib/runtime-core/src/macros.rs b/lib/runtime-core/src/macros.rs index 4d42c3157..52bf892ce 100644 --- a/lib/runtime-core/src/macros.rs +++ b/lib/runtime-core/src/macros.rs @@ -1,8 +1,15 @@ -#![allow(unused)] - +#[macro_export] +#[cfg(feature = "debug")] macro_rules! debug { - ($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) }); - ($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*) }); + ($fmt:expr) => (println!(concat!("wasmer-runtime(:{})::", $fmt), line!())); + ($fmt:expr, $($arg:tt)*) => (println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*)); +} + +#[macro_export] +#[cfg(not(feature = "debug"))] +macro_rules! debug { + ($fmt:expr) => {}; + ($fmt:expr, $($arg:tt)*) => {}; } #[macro_export] diff --git a/src/lib.rs b/src/lib.rs index 0a177d348..8022c6eab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,7 @@ +#[macro_use] extern crate wasmer_runtime_core; // extern crate wasmer_emscripten; -#[macro_use] -mod macros; #[macro_use] pub mod update; pub mod webassembly; diff --git a/src/macros.rs b/src/macros.rs deleted file mode 100644 index f69d2dca5..000000000 --- a/src/macros.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[macro_export] -macro_rules! debug { - ($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("Wasmer::", $fmt)) }); - ($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("Wasmer::", $fmt, "\n"), $($arg)*) }); -}