Mercurial > hg > index.cgi
changeset 362:d149e2b56981
Silence tautological comparison warnings
Because "char" may be signed or unsigned depending on the system, comparing
for byte values 128...255 has to be forced as an unsigned comparison to be
portable and clear. Modify two such comparisons in the symbol handling code
to treat the symbol offset as a pointer to unsigned. This quiets
tautological comparison warnings on systems with an 8 bit signed type as the
default char type.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 26 May 2015 23:42:00 -0600 |
parents | 4130ffdeb5c8 |
children | f90c9b044220 |
files | lwasm/symbol.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/symbol.c Tue May 26 17:53:51 2015 -0600 +++ b/lwasm/symbol.c Tue May 26 23:42:00 2015 -0600 @@ -93,7 +93,7 @@ lwasm_register_error(as, cl, "Bad symbol (%s)", sym); return NULL; } - if (*sym < 0x80 && (!strchr(SSYMCHARS, *sym) && !strchr(sym + 1, '$') && !strchr(sym + 1, '@') && !strchr(sym + 1, '?'))) + if (*(unsigned char *)sym < 0x80 && (!strchr(SSYMCHARS, *sym) && !strchr(sym + 1, '$') && !strchr(sym + 1, '@') && !strchr(sym + 1, '?'))) { lwasm_register_error(as, cl, "Bad symbol (%s)", sym); return NULL; @@ -114,7 +114,7 @@ islocal = 1; // bad symbol - if (!(flags & symbol_flag_nocheck) && *cp < 0x80 && !strchr(SYMCHARS, *cp)) + if (!(flags & symbol_flag_nocheck) && *(unsigned char *)cp < 0x80 && !strchr(SYMCHARS, *cp)) { lwasm_register_error(as, cl, "Bad symbol (%s)", sym); return NULL;