From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 19:03:24
|
Commit-ID: 7214d18b405f883010a74a3f8281c7906a5a21ca Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7214d18b405f883010a74a3f8281c7906a5a21ca Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 22:43:51 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 1 Mar 2016 22:43:51 -0800 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 <hp...@zy...> --- float.h | 2 +- nasm.c | 2 +- nasm.h | 24 ++++++++++++------------ output/codeview.c | 4 ++-- output/outelf32.c | 2 +- output/outmacho.c | 2 +- output/stabs.h | 6 +++--- pptok.pl | 6 ++++-- quote.c | 6 +++--- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/float.h b/float.h index a00a043..b07e542 100644 --- a/float.h +++ b/float.h @@ -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); diff --git a/nasm.c b/nasm.c index bff3b49..20e01b6 100644 --- a/nasm.c +++ b/nasm.c @@ -615,7 +615,7 @@ struct textargs { enum text_options { OPT_PREFIX, - OPT_POSTFIX, + OPT_POSTFIX }; static const struct textargs textopts[] = { {"prefix", OPT_PREFIX}, diff --git a/nasm.h b/nasm.h index 9e4fa96..77c90b0 100644 --- a/nasm.h +++ b/nasm.h @@ -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 d1828a5..2df6b05 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 24efc0f..455f2b9 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 56b53d4..8ad52c2 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 1480d88..3a09c41 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_ */ diff --git a/pptok.pl b/pptok.pl index 2dbf0fe..53a1c92 100755 --- a/pptok.pl +++ b/pptok.pl @@ -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; diff --git a/quote.c b/quote.c index 0132b05..d1cbfd4 100644 --- a/quote.c +++ b/quote.c @@ -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]; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-03-02 18:51:21
|
Commit-ID: 53f1559c06d8ca5578c61d3897d131b83f841689 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=53f1559c06d8ca5578c61d3897d131b83f841689 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 1 Mar 2016 22:43:51 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Wed, 2 Mar 2016 10:48:53 -0800 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 7214d18b405f883010a74a3f8281c7906a5a21ca Resolved Conflicts: output/outelf32.c Signed-off-by: H. Peter Anvin <hp...@zy...> --- float.h | 2 +- nasm.c | 2 +- nasm.h | 24 ++++++++++++------------ output/codeview.c | 4 ++-- output/outelf32.c | 2 +- output/outmacho.c | 2 +- output/stabs.h | 6 +++--- pptok.pl | 6 ++++-- quote.c | 6 +++--- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/float.h b/float.h index 6f94cc6..6823cd4 100644 --- a/float.h +++ b/float.h @@ -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, diff --git a/nasm.c b/nasm.c index 469cd51..5556e06 100644 --- a/nasm.c +++ b/nasm.c @@ -614,7 +614,7 @@ struct textargs { enum text_options { OPT_PREFIX, - OPT_POSTFIX, + OPT_POSTFIX }; struct textargs textopts[] = { {"prefix", OPT_PREFIX}, diff --git a/nasm.h b/nasm.h index f0cc346..48284f6 100644 --- a/nasm.h +++ b/nasm.h @@ -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 */ diff --git a/output/codeview.c b/output/codeview.c index 975eef9..86050ec 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 e4971ed..a8b181a 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -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; diff --git a/output/outmacho.c b/output/outmacho.c index 881a4ae..746dbcb 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 1480d88..3a09c41 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_ */ diff --git a/pptok.pl b/pptok.pl index 2dbf0fe..53a1c92 100755 --- a/pptok.pl +++ b/pptok.pl @@ -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; diff --git a/quote.c b/quote.c index 0132b05..d1cbfd4 100644 --- a/quote.c +++ b/quote.c @@ -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]; |