From a1a691a030d065bf234f8a476e3b958e43b1b7c5 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 24 Sep 2013 15:32:52 +0200 Subject: Detect correct instruction with incorrect operands Display a different warning when an instruction is recognized by tcc but the operands found do not correspond to the constraints of the instruction. --- i386-asm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'i386-asm.c') diff --git a/i386-asm.c b/i386-asm.c index f9c0fa7..8473d06 100644 --- a/i386-asm.c +++ b/i386-asm.c @@ -27,6 +27,7 @@ #define TOK_ASM_first TOK_ASM_clc #define TOK_ASM_last TOK_ASM_emms +#define TOK_ASM_alllast TOK_ASM_pxor #define OPC_JMP 0x01 /* jmp operand */ #define OPC_B 0x02 /* only used with OPC_WL */ @@ -715,6 +716,9 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) g(b >> 8); g(b); return; + } else if (opcode <= TOK_ASM_alllast) { + tcc_error("bad operand with opcode '%s'", + get_tok_str(opcode, NULL)); } else { tcc_error("unknown opcode '%s'", get_tok_str(opcode, NULL)); -- cgit v1.3.1