diff options
| author | Andrei Warkentin <andrey.warkentin@gmail.com> | 2017-03-28 02:51:39 -0400 |
|---|---|---|
| committer | Andrei Warkentin <awarkentin@awarkentin-mba.local> | 2017-04-25 13:55:18 +0300 |
| commit | 63b2f907bd9f8ad82b2cfaf8a34497578877253b (patch) | |
| tree | 8424ba19fad0a1d6812fc61dde9ecfd2f81374d2 /i386-asm.c | |
| parent | 91cd148a05e2c492a02eb77b12a2581b87bc9822 (diff) | |
| download | tinycc-63b2f907bd9f8ad82b2cfaf8a34497578877253b.tar.gz tinycc-63b2f907bd9f8ad82b2cfaf8a34497578877253b.tar.bz2 | |
tcc: fixup clang warnings
The O(xxx) stuff in i386-asm.c had me scratching my head. Extracting
the macro and trying it out in a separate program doesn't give
me any warnings, so I'm confused about what could be going on there.
Any cast will make things happy. I used a uint64_t to catch actual
cases of overflow, which will still cause a -Wconstant-conversion
warning.
Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Diffstat (limited to 'i386-asm.c')
| -rw-r--r-- | i386-asm.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -221,7 +221,7 @@ static const uint8_t segment_prefixes[] = { static const ASMInstr asm_instrs[] = { #define ALT(x) x /* This removes a 0x0f in the second byte */ -#define O(o) ((((o) & 0xff00) == 0x0f00) ? ((((o) >> 8) & ~0xff) | ((o) & 0xff)) : (o)) +#define O(o) ((uint64_t) ((((o) & 0xff00) == 0x0f00) ? ((((o) >> 8) & ~0xff) | ((o) & 0xff)) : (o))) /* This constructs instr_type from opcode, type and group. */ #define T(o,i,g) ((i) | ((g) << OPC_GROUP_SHIFT) | ((((o) & 0xff00) == 0x0f00) ? OPC_0F : 0)) #define DEF_ASM_OP0(name, opcode) @@ -278,7 +278,7 @@ static inline int get_reg_shift(TCCState *s1) } #ifdef TCC_TARGET_X86_64 -static int asm_parse_numeric_reg(int t, int *type) +static int asm_parse_numeric_reg(int t, unsigned int *type) { int reg = -1; if (t >= TOK_IDENT && t < tok_ident) { @@ -317,7 +317,7 @@ static int asm_parse_numeric_reg(int t, int *type) } #endif -static int asm_parse_reg(int *type) +static int asm_parse_reg(unsigned int *type) { int reg = 0; *type = 0; @@ -453,7 +453,7 @@ static void parse_operand(TCCState *s1, Operand *op) op->e.pcrel = 0; } if (tok == '(') { - int type = 0; + unsigned int type = 0; next(); if (tok != ',') { op->reg = asm_parse_reg(&type); @@ -1688,7 +1688,7 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) int reg; TokenSym *ts; #ifdef TCC_TARGET_X86_64 - int type; + unsigned int type; #endif if (!strcmp(str, "memory") || |
