Merge pull request #129 from wasmerio/fix/update-debug-macro

Consolidate to single debug macro, activate using feature
This commit is contained in:
Syrus Akbary 2019-01-29 19:00:56 -05:00 committed by GitHub
commit c5dea064c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 15 deletions

View File

@ -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)*) });
}

View File

@ -1,8 +1,15 @@
#![allow(unused)] #[macro_export]
#[cfg(feature = "debug")]
macro_rules! debug { macro_rules! debug {
($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) }); ($fmt:expr) => (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, $($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] #[macro_export]

View File

@ -1,8 +1,7 @@
#[macro_use]
extern crate wasmer_runtime_core; extern crate wasmer_runtime_core;
// extern crate wasmer_emscripten; // extern crate wasmer_emscripten;
#[macro_use]
mod macros;
#[macro_use] #[macro_use]
pub mod update; pub mod update;
pub mod webassembly; pub mod webassembly;

View File

@ -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)*) });
}