diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-03-01 22:43:51 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-03-01 22:43:51 -0800 |
commit | 7214d18b405f883010a74a3f8281c7906a5a21ca (patch) | |
tree | 7ab8132720f54e635de2272c5bd2bd7857e212ad | |
parent | 25da6eaf434705a6ad01f252132dc7f109493c67 (diff) | |
download | nasm-7214d18b405f883010a74a3f8281c7906a5a21ca.tar.gz |
Remove unnecessary C99-isms
In order to make it more likely to compile cleanly with "C90 plus long
long" style compilers, make gcc warn for incompatible constructs.
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...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | float.h | 2 | ||||
-rw-r--r-- | nasm.c | 2 | ||||
-rw-r--r-- | nasm.h | 24 | ||||
-rw-r--r-- | output/codeview.c | 4 | ||||
-rw-r--r-- | output/outelf32.c | 2 | ||||
-rw-r--r-- | output/outmacho.c | 2 | ||||
-rw-r--r-- | output/stabs.h | 6 | ||||
-rwxr-xr-x | pptok.pl | 6 | ||||
-rw-r--r-- | quote.c | 6 |
9 files changed, 28 insertions, 26 deletions
@@ -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); @@ -615,7 +615,7 @@ struct textargs { enum text_options { OPT_PREFIX, - OPT_POSTFIX, + OPT_POSTFIX }; static const struct textargs textopts[] = { {"prefix", OPT_PREFIX}, @@ -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 */ }; /* @@ -164,7 +164,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 { @@ -175,7 +175,7 @@ enum floatize { FLOAT_80M, FLOAT_80E, FLOAT_128L, - FLOAT_128H, + FLOAT_128H }; /* Must match the list in string_transform(), in strfunc.c */ @@ -185,14 +185,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); @@ -471,7 +471,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 */ }; /* @@ -516,7 +516,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 */ @@ -526,14 +526,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 */ @@ -573,7 +573,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 */ }; /* @@ -617,7 +617,7 @@ enum ttypes { QVM = 015, OVM = 016, M128 = 017, - DUP = 020, + DUP = 020 }; /* EVEX.L'L : Vector length on vector insns */ @@ -625,7 +625,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 */ diff --git a/output/codeview.c b/output/codeview.c index d1828a58..2df6b056 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -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; }; diff --git a/output/outelf32.c b/output/outelf32.c index 24efc0f5..455f2b98 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1160,7 +1160,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 (dfmt == &df_dwarf) { dwarf_infosym = *local; p = entry; diff --git a/output/outmacho.c b/output/outmacho.c index 56b53d47..8ad52c24 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -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 diff --git a/output/stabs.h b/output/stabs.h index 1480d88f..3a09c415 100644 --- a/output/stabs.h +++ b/output/stabs.h @@ -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_ */ @@ -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; @@ -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]; |