Skip to content

Commit

Permalink
Don't shadow the provided stringify! macro in a wasm code size test…
Browse files Browse the repository at this point in the history
… case
  • Loading branch information
fitzgen committed Feb 8, 2019
1 parent 8fea705 commit f00f0e6
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions src/test/run-make/wasm-stringify-ints-small/foo.rs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@

extern "C" {
fn observe(ptr: *const u8, len: usize);

fn get_u8() -> u8;
fn get_i8() -> i8;
fn get_u16() -> u16;
fn get_i16() -> i16;
fn get_u32() -> u32;
fn get_i32() -> i32;
fn get_u64() -> u64;
fn get_i64() -> i64;
fn get_usize() -> usize;
fn get_isize() -> isize;
}

macro_rules! stringify {
( $($f:ident)* ) => {
macro_rules! s {
( $( $f:ident -> $t:ty );* $(;)* ) => {
$(
extern "C" {
fn $f() -> $t;
}
let s = $f().to_string();
observe(s.as_ptr(), s.len());
)*
Expand All @@ -26,14 +18,16 @@ macro_rules! stringify {

#[no_mangle]
pub unsafe extern "C" fn foo() {
stringify!(get_u8);
stringify!(get_i8);
stringify!(get_u16);
stringify!(get_i16);
stringify!(get_u32);
stringify!(get_i32);
stringify!(get_u64);
stringify!(get_i64);
stringify!(get_usize);
stringify!(get_isize);
s! {
get_u8 -> u8;
get_i8 -> i8;
get_u16 -> u16;
get_i16 -> i16;
get_u32 -> u32;
get_i32 -> i32;
get_u64 -> u64;
get_i64 -> i64;
get_usize -> usize;
get_isize -> isize;
}
}

0 comments on commit f00f0e6

Please sign in to comment.