File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ edition = "2018"
9
9
[dependencies ]
10
10
clap = { version = " 3.2.22" , features = [" derive" ] }
11
11
color-eyre = " 0.6.2"
12
+ colored = " 2.1.0"
12
13
13
14
# Speed up `backtrace` even on a debug build. Suggested by `color-eyre`.
14
15
[profile .dev .package .backtrace ]
Original file line number Diff line number Diff line change 4
4
use crate :: wasm:: syntax:: * ;
5
5
use crate :: Maybe ;
6
6
use color_eyre:: eyre:: eyre;
7
+ use colored:: Colorize ;
7
8
use std:: collections:: HashMap ;
8
9
use std:: convert:: TryInto ;
9
10
@@ -48,6 +49,12 @@ macro_rules! err {
48
49
} }
49
50
}
50
51
52
+ macro_rules! warn {
53
+ ( $( $args: tt) * ) => { {
54
+ eprintln!( "{}" , format_args!( "WARNING -- {}" , $( $args) * ) . to_string( ) . green( ) ) ;
55
+ } }
56
+ }
57
+
51
58
/// Little Endian Base 128 encoding of unsigned ints. Parses `bits` bits into a `u64`.
52
59
fn leb128_u ( mut inp : & [ u8 ] , bits : usize ) -> Parsed < u64 > {
53
60
let n = inp[ 0 ] as u64 ;
@@ -880,11 +887,9 @@ generate! { module -> Module = {
880
887
let mut data: & [ u8 ] = data;
881
888
let names = run_parser!( names( data) ) ;
882
889
// below check seems broken, see https://github.com/secure-foundations/rWasm/issues/2
883
- // if data.len() == 0 {
884
- // names
885
- // } else {
886
- // err!("Unused bytes in the custom name section")
887
- // }
890
+ if data. len( ) != 0 {
891
+ warn!( "Unused bytes in the custom name section; ingoring" )
892
+ }
888
893
names
889
894
} else {
890
895
Names {
You can’t perform that action at this time.
0 commit comments