From 09dff8b2577ed93fcefaf1eac31e41785bf7a473 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 1 Mar 2017 01:01:37 -0800 Subject: [PATCH] Remove casts in switch statements only meant to keep OpenWatcom happy Remove casts in switch statements that were intended to keep OpenWatcom happy. It didn't work, and now we have a more general solution for the problem, which also ought to be less dangerous. Signed-off-by: H. Peter Anvin --- asm/nasm.c | 2 +- asm/parser.c | 6 +++--- output/outas86.c | 2 +- output/outieee.c | 2 +- output/outobj.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 29cade7a..dc8eecff 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1586,7 +1586,7 @@ static void assemble_file(char *fname, StrList **depend_ptr) stdscan_set(value); tokval.t_type = TOKEN_INVALID; if (stdscan(NULL, &tokval) != TOKEN_INVALID) { - switch ((int)tokval.t_integer) { + switch (tokval.t_integer) { case S_REL: globalrel = 1; break; diff --git a/asm/parser.c b/asm/parser.c index 7f834227..42c988e4 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -107,7 +107,7 @@ static int prefix_slot(int prefix) static void process_size_override(insn *result, operand *op) { if (tasm_compatible_mode) { - switch ((int)tokval.t_integer) { + switch (tokval.t_integer) { /* For TASM compatibility a size override inside the * brackets changes the size of the operand, not the * address type of the operand as it does in standard @@ -146,7 +146,7 @@ static void process_size_override(insn *result, operand *op) } } else { /* Standard NASM compatible syntax */ - switch ((int)tokval.t_integer) { + switch (tokval.t_integer) { case S_NOSPLIT: op->eaflags |= EAF_TIMESTWO; break; @@ -788,7 +788,7 @@ is_expression: first = false; op->type = 0; /* so far, no override */ while (i == TOKEN_SPECIAL) { /* size specifiers */ - switch ((int)tokval.t_integer) { + switch (tokval.t_integer) { case S_BYTE: if (!setsize) /* we want to use only the first */ op->type |= BITS8; diff --git a/output/outas86.c b/output/outas86.c index 3079bc82..631aff0f 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -581,7 +581,7 @@ static void as86_write_section(struct Section *sect, int index) fwriteint16_t(p->number, ofile); else fputc(p->number, ofile); - switch ((int)s) { + switch (s) { case 0: break; case 1: diff --git a/output/outieee.c b/output/outieee.c index ff242ac6..da5b71c8 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -787,7 +787,7 @@ static int32_t ieee_segment(char *name, int pass, int *bits) nasm_error(ERR_NONFATAL, "segment alignment should be" " numeric"); } - switch ((int)seg->align) { + switch (seg->align) { case 1: /* BYTE */ case 2: /* WORD */ case 4: /* DWORD */ diff --git a/output/outobj.c b/output/outobj.c index 4ff33e0c..afb88e8c 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1495,7 +1495,7 @@ static int32_t obj_segment(char *name, int pass, int *bits) nasm_error(ERR_NONFATAL, "segment alignment should be" " numeric"); } - switch ((int)seg->align) { + switch (seg->align) { case 1: /* BYTE */ case 2: /* WORD */ case 4: /* DWORD */