From 0171e6be4a499869ef551ddc33f05b09213cccbd Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sat, 2 Feb 2019 00:13:52 +0800 Subject: [PATCH] wasm: silence some compilation warnings --- cstool/cstool_arm.c | 1 + cstool/cstool_arm64.c | 1 + cstool/cstool_evm.c | 1 + cstool/cstool_m680x.c | 4 +++- cstool/cstool_m68k.c | 1 + cstool/cstool_mips.c | 1 + cstool/cstool_mos65xx.c | 3 ++- cstool/cstool_ppc.c | 2 ++ cstool/cstool_sparc.c | 2 ++ cstool/cstool_systemz.c | 1 + cstool/cstool_tms320c64x.c | 1 + cstool/cstool_wasm.c | 23 ++++++++++++----------- cstool/cstool_x86.c | 2 ++ cstool/cstool_xcore.c | 1 + tests/test_wasm.c | 24 ++++++++++++------------ 15 files changed, 43 insertions(+), 25 deletions(-) diff --git a/cstool/cstool_arm.c b/cstool/cstool_arm.c index 57f1d435..26cba3bd 100644 --- a/cstool/cstool_arm.c +++ b/cstool/cstool_arm.c @@ -3,6 +3,7 @@ #include +void print_insn_detail_arm(csh handle, cs_insn *ins); void print_insn_detail_arm(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_arm64.c b/cstool/cstool_arm64.c index 79841dd0..61eeba7f 100644 --- a/cstool/cstool_arm64.c +++ b/cstool/cstool_arm64.c @@ -6,6 +6,7 @@ #include +void print_insn_detail_arm64(csh handle, cs_insn *ins); void print_insn_detail_arm64(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_evm.c b/cstool/cstool_evm.c index 0b104704..d3ecb5c3 100644 --- a/cstool/cstool_evm.c +++ b/cstool/cstool_evm.c @@ -3,6 +3,7 @@ #include +void print_insn_detail_evm(csh handle, cs_insn *ins); void print_insn_detail_evm(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_m680x.c b/cstool/cstool_m680x.c index a59639da..682b73c1 100644 --- a/cstool/cstool_m680x.c +++ b/cstool/cstool_m680x.c @@ -4,12 +4,14 @@ #include #include +void print_insn_detail_m680x(csh handle, cs_insn *insn); + static const char *s_access[] = { "UNCHANGED", "READ", "WRITE", "READ | WRITE", }; -void print_read_write_regs(csh handle, cs_detail *detail) +static void print_read_write_regs(csh handle, cs_detail *detail) { int i; diff --git a/cstool/cstool_m68k.c b/cstool/cstool_m68k.c index 62098a29..9d860ea9 100644 --- a/cstool/cstool_m68k.c +++ b/cstool/cstool_m68k.c @@ -9,6 +9,7 @@ #include #include +void print_insn_detail_m68k(csh handle, cs_insn *ins); static const char* s_addressing_modes[] = { "", diff --git a/cstool/cstool_mips.c b/cstool/cstool_mips.c index 50f40eed..df87aeae 100644 --- a/cstool/cstool_mips.c +++ b/cstool/cstool_mips.c @@ -6,6 +6,7 @@ #include +void print_insn_detail_mips(csh handle, cs_insn *ins); void print_insn_detail_mips(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_mos65xx.c b/cstool/cstool_mos65xx.c index 6b29aafc..afd532eb 100644 --- a/cstool/cstool_mos65xx.c +++ b/cstool/cstool_mos65xx.c @@ -3,7 +3,8 @@ #include -void print_string_hex(char *comment, unsigned char *str, size_t len); +void print_insn_detail_mos65xx(csh handle, cs_insn *ins); + static const char *get_am_name(mos65xx_address_mode mode) { diff --git a/cstool/cstool_ppc.c b/cstool/cstool_ppc.c index 5e59231e..73de772f 100644 --- a/cstool/cstool_ppc.c +++ b/cstool/cstool_ppc.c @@ -5,6 +5,8 @@ #include +void print_insn_detail_ppc(csh handle, cs_insn *ins); + static const char* get_bc_name(int bc) { diff --git a/cstool/cstool_sparc.c b/cstool/cstool_sparc.c index a71a9293..f3594a59 100644 --- a/cstool/cstool_sparc.c +++ b/cstool/cstool_sparc.c @@ -5,6 +5,8 @@ #include +void print_insn_detail_sparc(csh handle, cs_insn *ins); + void print_insn_detail_sparc(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_systemz.c b/cstool/cstool_systemz.c index 2d39ba8e..002f9a80 100644 --- a/cstool/cstool_systemz.c +++ b/cstool/cstool_systemz.c @@ -5,6 +5,7 @@ #include +void print_insn_detail_sysz(csh handle, cs_insn *ins); void print_insn_detail_sysz(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_tms320c64x.c b/cstool/cstool_tms320c64x.c index 5d56480e..7eae894a 100644 --- a/cstool/cstool_tms320c64x.c +++ b/cstool/cstool_tms320c64x.c @@ -4,6 +4,7 @@ #include #include +void print_insn_detail_tms320c64x(csh handle, cs_insn *ins); void print_insn_detail_tms320c64x(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_wasm.c b/cstool/cstool_wasm.c index d4b997a3..80bb2b91 100644 --- a/cstool/cstool_wasm.c +++ b/cstool/cstool_wasm.c @@ -3,6 +3,7 @@ #include +void print_insn_detail_wasm(csh handle, cs_insn *ins); void print_insn_detail_wasm(csh handle, cs_insn *ins) { @@ -23,28 +24,28 @@ void print_insn_detail_wasm(csh handle, cs_insn *ins) default: break; case WASM_OP_INT7: - printf("\t\tOperand[%d] type: int7\n", i); - printf("\t\tOperand[%d] value: %d\n", i, wasm->operands[i].int7); + printf("\t\tOperand[%u] type: int7\n", i); + printf("\t\tOperand[%u] value: %d\n", i, wasm->operands[i].int7); break; case WASM_OP_UINT32: - printf("\t\tOperand[%d] type: uint32\n", i); - printf("\t\tOperand[%d] value: 0x%x\n", i, wasm->operands[i].uint32); + printf("\t\tOperand[%u] type: uint32\n", i); + printf("\t\tOperand[%u] value: 0x%x\n", i, wasm->operands[i].uint32); break; case WASM_OP_UINT64: - printf("\t\tOperand[%d] type: uint64\n", i); - printf("\t\tOperand[%d] value: 0x%lx\n", i, wasm->operands[i].uint64); + printf("\t\tOperand[%u] type: uint64\n", i); + printf("\t\tOperand[%u] value: 0x%" PRIx64 "\n", i, wasm->operands[i].uint64); break; case WASM_OP_VARUINT32: - printf("\t\tOperand[%d] type: varuint32\n", i); - printf("\t\tOperand[%d] value: 0x%x\n", i, wasm->operands[i].varuint32); + printf("\t\tOperand[%u] type: varuint32\n", i); + printf("\t\tOperand[%u] value: 0x%x\n", i, wasm->operands[i].varuint32); break; case WASM_OP_VARUINT64: - printf("\t\tOperand[%d] type: varuint64\n", i); - printf("\t\tOperand[%d] value: 0x%lx\n", i, wasm->operands[i].varuint64); + printf("\t\tOperand[%u] type: varuint64\n", i); + printf("\t\tOperand[%u] value: 0x%" PRIx64 "\n", i, wasm->operands[i].varuint64); break; } - printf("\t\tOperand[%d] size: %d\n", i, wasm->operands[i].size); + printf("\t\tOperand[%u] size: %u\n", i, wasm->operands[i].size); } } } diff --git a/cstool/cstool_x86.c b/cstool/cstool_x86.c index ff3be36f..e504e8a1 100644 --- a/cstool/cstool_x86.c +++ b/cstool/cstool_x86.c @@ -5,6 +5,8 @@ #include +void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins); + void print_string_hex(const char *comment, unsigned char *str, size_t len); static const char *get_eflag_name(uint64_t flag) diff --git a/cstool/cstool_xcore.c b/cstool/cstool_xcore.c index 42d986fa..2ab95507 100644 --- a/cstool/cstool_xcore.c +++ b/cstool/cstool_xcore.c @@ -4,6 +4,7 @@ #include #include +void print_insn_detail_xcore(csh handle, cs_insn *ins); void print_insn_detail_xcore(csh handle, cs_insn *ins) { diff --git a/tests/test_wasm.c b/tests/test_wasm.c index dc0e84ca..077daa9c 100644 --- a/tests/test_wasm.c +++ b/tests/test_wasm.c @@ -50,7 +50,7 @@ static void print_insn_detail(csh cs_handle, cs_insn *ins) wasm = &(ins->detail->wasm); if (wasm->op_count > 0) { - int i; + unsigned int i; printf("\tOperand count: %u\n", wasm->op_count); @@ -59,27 +59,27 @@ static void print_insn_detail(csh cs_handle, cs_insn *ins) default: break; case WASM_OP_INT7: - printf("\t\tOperand[%d] type: int7\n", i); - printf("\t\tOperand[%d] value: %d\n", i, wasm->operands[i].int7); + printf("\t\tOperand[%u] type: int7\n", i); + printf("\t\tOperand[%u] value: %d\n", i, wasm->operands[i].int7); break; case WASM_OP_UINT32: - printf("\t\tOperand[%d] type: uint32\n", i); - printf("\t\tOperand[%d] value: 0x%x\n", i, wasm->operands[i].uint32); + printf("\t\tOperand[%u] type: uint32\n", i); + printf("\t\tOperand[%u] value: 0x%x\n", i, wasm->operands[i].uint32); break; case WASM_OP_UINT64: - printf("\t\tOperand[%d] type: uint64\n", i); - printf("\t\tOperand[%d] value: 0x%lx\n", i, wasm->operands[i].uint64); + printf("\t\tOperand[%u] type: uint64\n", i); + printf("\t\tOperand[%u] value: 0x%" PRIx64 "\n", i, wasm->operands[i].uint64); break; case WASM_OP_VARUINT32: - printf("\t\tOperand[%d] type: varuint32\n", i); - printf("\t\tOperand[%d] value: 0x%x\n", i, wasm->operands[i].varuint32); + printf("\t\tOperand[%u] type: varuint32\n", i); + printf("\t\tOperand[%u] value: 0x%x\n", i, wasm->operands[i].varuint32); break; case WASM_OP_VARUINT64: - printf("\t\tOperand[%d] type: varuint64\n", i); - printf("\t\tOperand[%d] value: 0x%lx\n", i, wasm->operands[i].varuint64); + printf("\t\tOperand[%u] type: varuint64\n", i); + printf("\t\tOperand[%u] value: 0x%" PRIx64 "\n", i, wasm->operands[i].varuint64); break; } - printf("\t\tOperand[%d] size: %u\n", i, wasm->operands[i].size); + printf("\t\tOperand[%u] size: %u\n", i, wasm->operands[i].size); } } }