Remove unnecessary C99-isms

In order to make it more likely to compile cleanly with "C90 plus long
long" style compilers, remove existing constructs (mostly commas at
the end of enums) that aren't compliant.

Ironically enough this was most likely an unintentional omission in
C90...

From master branch checkin 7214d18b40

Resolved Conflicts:
	output/outelf32.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2016-03-01 22:43:51 -08:00
parent 8d9f591005
commit 53f1559c06
9 changed files with 28 additions and 26 deletions

View File

@ -45,7 +45,7 @@ enum float_round {
FLOAT_RC_NEAR,
FLOAT_RC_ZERO,
FLOAT_RC_DOWN,
FLOAT_RC_UP,
FLOAT_RC_UP
};
int float_const(const char *string, int sign, uint8_t *result, int bytes,

2
nasm.c
View File

@ -614,7 +614,7 @@ struct textargs {
enum text_options {
OPT_PREFIX,
OPT_POSTFIX,
OPT_POSTFIX
};
struct textargs textopts[] = {
{"prefix", OPT_PREFIX},

24
nasm.h
View File

@ -106,7 +106,7 @@ enum out_type {
OUT_REL1ADR, /* 1-byte relative address */
OUT_REL2ADR, /* 2-byte relative address */
OUT_REL4ADR, /* 4-byte relative address */
OUT_REL8ADR, /* 8-byte relative address */
OUT_REL8ADR /* 8-byte relative address */
};
/*
@ -228,7 +228,7 @@ enum token_type { /* token types, other than chars */
TOKEN_STRFUNC, /* __utf16*__, __utf32*__ */
TOKEN_IFUNC, /* __ilog2*__ */
TOKEN_DECORATOR, /* decorators such as {...} */
TOKEN_OPMASK, /* translated token for opmask registers */
TOKEN_OPMASK /* translated token for opmask registers */
};
enum floatize {
@ -239,7 +239,7 @@ enum floatize {
FLOAT_80M,
FLOAT_80E,
FLOAT_128L,
FLOAT_128H,
FLOAT_128H
};
/* Must match the list in string_transform(), in strfunc.c */
@ -249,14 +249,14 @@ enum strfunc {
STRFUNC_UTF16BE,
STRFUNC_UTF32,
STRFUNC_UTF32LE,
STRFUNC_UTF32BE,
STRFUNC_UTF32BE
};
enum ifunc {
IFUNC_ILOG2E,
IFUNC_ILOG2W,
IFUNC_ILOG2F,
IFUNC_ILOG2C,
IFUNC_ILOG2C
};
size_t string_transform(char *, size_t, char **, enum strfunc);
@ -534,7 +534,7 @@ static inline uint8_t get_cond_opcode(enum ccode c)
enum vex_class {
RV_VEX = 0, /* C4/C5 */
RV_XOP = 1, /* 8F */
RV_EVEX = 2, /* 62 */
RV_EVEX = 2 /* 62 */
};
/*
@ -575,7 +575,7 @@ enum extop_type { /* extended operand types */
EOT_NOTHING,
EOT_DB_STRING, /* Byte string */
EOT_DB_STRING_FREE, /* Byte string which should be nasm_free'd*/
EOT_DB_NUMBER, /* Integer */
EOT_DB_NUMBER /* Integer */
};
enum ea_flags { /* special EA flags */
@ -585,14 +585,14 @@ enum ea_flags { /* special EA flags */
EAF_REL = 8, /* IP-relative addressing */
EAF_ABS = 16, /* non-IP-relative addressing */
EAF_FSGS = 32, /* fs/gs segment override present */
EAF_MIB = 64, /* mib operand */
EAF_MIB = 64 /* mib operand */
};
enum eval_hint { /* values for `hinttype' */
EAH_NOHINT = 0, /* no hint at all - our discretion */
EAH_MAKEBASE = 1, /* try to make given reg the base */
EAH_NOTBASE = 2, /* try _not_ to make reg the base */
EAH_SUMMED = 3, /* base and index are summed into index */
EAH_SUMMED = 3 /* base and index are summed into index */
};
typedef struct operand { /* operand to an instruction */
@ -632,7 +632,7 @@ enum ea_type {
EA_SCALAR, /* Scalar EA */
EA_XMMVSIB, /* XMM vector EA */
EA_YMMVSIB, /* YMM vector EA */
EA_ZMMVSIB, /* ZMM vector EA */
EA_ZMMVSIB /* ZMM vector EA */
};
/*
@ -676,7 +676,7 @@ enum ttypes {
QVM = 015,
OVM = 016,
M128 = 017,
DUP = 020,
DUP = 020
};
/* EVEX.L'L : Vector length on vector insns */
@ -684,7 +684,7 @@ enum vectlens {
VL128 = 0,
VL256 = 1,
VL512 = 2,
VLMAX = 3,
VLMAX = 3
};
/* If you need to change this, also change it in insns.pl */

View File

@ -89,7 +89,7 @@ enum symbol_type {
SYMTYPE_LDATA,
SYMTYPE_GDATA,
SYMTYPE_MAX,
SYMTYPE_MAX
};
struct cv8_symbol {
@ -113,7 +113,7 @@ struct cv8_symbol {
TYPE_REAL80 = 0x0042,
TYPE_REAL128= 0x0043,
TYPE_REAL256= 0x0044,
TYPE_REAL512= 0x0045,
TYPE_REAL512= 0x0045
} symtype;
};

View File

@ -1162,7 +1162,7 @@ static struct SAA *elf_build_symtab(int32_t *len, int32_t *local)
* dwarf needs symbols for debug sections
* which are relocation targets.
*/
//*** fix for 32 bit
/*** fix for 32 bit ***/
if (of_elf32.current_dfmt == &df_dwarf) {
dwarf_infosym = *local;
p = entry;

View File

@ -114,7 +114,7 @@ enum reltype {
RL_BRANCH, /* Relative direct branch */
RL_SUB, /* X86_64_RELOC_SUBTRACT */
RL_GOT, /* X86_64_RELOC_GOT */
RL_GOTLOAD, /* X86_64_RELOC_GOT_LOAD */
RL_GOTLOAD /* X86_64_RELOC_GOT_LOAD */
};
#define RL_MAX_32 RL_TLV
#define RL_MAX_64 RL_GOTLOAD

View File

@ -48,7 +48,7 @@ enum stab_offsets {
STAB_otheroff = 5,
STAB_descoff = 6,
STAB_valoff = 8,
STAB_stabsize = 12,
STAB_stabsize = 12
};
/* stab/non-stab types */
@ -127,7 +127,7 @@ enum stab_types {
N_NBBSS = 0xf4,
N_NBSTS = 0xf6,
N_NBLCS = 0xf8,
N_LENG = 0xfe,
N_LENG = 0xfe
};
enum stab_source_file {
@ -139,7 +139,7 @@ enum stab_source_file {
N_SO_PASCAL = 0x06,
N_SO_FORTRAN90 = 0x07,
N_SO_OBJC = 0x32,
N_SO_OBJCPLUS = 0x33,
N_SO_OBJCPLUS = 0x33
};
#endif /* STABS_H_ */

View File

@ -110,13 +110,15 @@ if ($what eq 'h') {
print OUT "enum pp_conditional {\n";
$n = 0;
$c = '';
foreach $cc (@cond) {
if (defined($cc)) {
printf OUT " %-16s = %3d,\n", "PPC_IF\U$cc\E", $n;
printf OUT "$c %-16s = %3d", "PPC_IF\U$cc\E", $n;
$c = ',';
}
$n += 2;
}
print OUT "};\n\n";
print OUT "\n};\n\n";
printf OUT "#define PP_COND(x) ((enum pp_conditional)((x) & 0x%x))\n",
(scalar(@cond)-1) << 1;

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@ -235,7 +235,7 @@ size_t nasm_unquote(char *str, char **ep)
st_backslash,
st_hex,
st_oct,
st_ucs,
st_ucs
} state;
int ndig = 0;
int32_t nval = 0;
@ -430,7 +430,7 @@ char *nasm_skip_string(char *str)
char c;
enum unq_state {
st_start,
st_backslash,
st_backslash
} state;
bq = str[0];