From 461126ce309f99e4ad2a6ddcbc175ea01c5e8fee Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Fri, 26 Jan 2024 01:26:09 +0100 Subject: feat: full no_std support Signed-off-by: Henry Gressmann --- crates/parser/src/conversion.rs | 6 +++--- crates/parser/src/lib.rs | 2 ++ crates/parser/src/module.rs | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'crates/parser') diff --git a/crates/parser/src/conversion.rs b/crates/parser/src/conversion.rs index 90dde8c..835842f 100644 --- a/crates/parser/src/conversion.rs +++ b/crates/parser/src/conversion.rs @@ -1,5 +1,5 @@ +use crate::log; use alloc::{boxed::Box, format, string::ToString, vec::Vec}; -use log::debug; use tinywasm_types::*; use wasmparser::{FuncValidator, OperatorsReader, ValidatorResources}; @@ -239,7 +239,7 @@ pub fn process_operators<'a>( let mut labels_ptrs = Vec::new(); // indexes into the instructions array for op in ops { - debug!("op: {:?}", op); + log::debug!("op: {:?}", op); let op = op?; validator.op(offset, &op)?; @@ -274,7 +274,7 @@ pub fn process_operators<'a>( } End => { if let Some(label_pointer) = labels_ptrs.pop() { - debug!("ending block: {:?}", instructions[label_pointer]); + log::debug!("ending block: {:?}", instructions[label_pointer]); let current_instr_ptr = instructions.len(); diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index aa76ea3..edcd280 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -14,7 +14,9 @@ use log; #[cfg(not(feature = "logging"))] mod log { macro_rules! debug ( ($($tt:tt)*) => {{}} ); + macro_rules! error ( ($($tt:tt)*) => {{}} ); pub(crate) use debug; + pub(crate) use error; } mod conversion; diff --git a/crates/parser/src/module.rs b/crates/parser/src/module.rs index 811c51f..e0fb0cc 100644 --- a/crates/parser/src/module.rs +++ b/crates/parser/src/module.rs @@ -181,9 +181,9 @@ impl ModuleReader { validator.end(offset)?; self.end_reached = true; } - CustomSection(reader) => { + CustomSection(_reader) => { debug!("Found custom section"); - debug!("Skipping custom section: {:?}", reader.name()); + debug!("Skipping custom section: {:?}", _reader.name()); } // TagSection(tag) => { // debug!("Found tag section"); -- cgit v1.3.1