summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-07 06:18:30 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-07 06:18:30 -0800
commit7ed9432eed94beef4f35f16df2c0bd53dd2ce4bc (patch)
tree4ac21fd4f2aa8f8ef67f424ab5a93d83c70e8bfd /parser.l
parent0a97556f505334bcf48987129b3d35c48efdbb62 (diff)
downloadtxr-7ed9432eed94beef4f35f16df2c0bd53dd2ce4bc.tar.gz
txr-7ed9432eed94beef4f35f16df2c0bd53dd2ce4bc.tar.bz2
txr-7ed9432eed94beef4f35f16df2c0bd53dd2ce4bc.zip
Fix some C style casts to use casting macros.
This is uncovered by compiling with g++ using -Wold-style-cast. * mpi/mpi.c (mp_get_intptr): Use convert macro. Also in one of the rules producing REGCHAR. * parser.l (num_esc): Likewise. * struct.c (static_slot_set, static_slot_ens_rec, get_equal_method): Use coerce macro for int to pointer conversion. * sysif.c (setgroups_wrap): Use convert macro. * termios.c (termios_unpack, termios_pack): Likewise. * txr.c (sysroot_init): Likewise.
Diffstat (limited to 'parser.l')
-rw-r--r--parser.l4
1 files changed, 2 insertions, 2 deletions
diff --git a/parser.l b/parser.l
index a123f2f1..7760553c 100644
--- a/parser.l
+++ b/parser.l
@@ -177,7 +177,7 @@ static wchar_t num_esc(scanner_t *scn, char *num)
val = strtol(num, 0, 8);
}
- if (val < 0 || val > 0x10FFFF || (wchar_t) val != val) {
+ if (val < 0 || val > 0x10FFFF || convert(wchar_t, val) != val) {
yyerror(scn, yyget_extra(scn), "numeric character escape out of range");
val = 0;
}
@@ -895,7 +895,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
<SREGEX>. {
/* Allow non-UTF-8 byte for regexes scanned from string */
- yylval->chr = (unsigned char) yytext[0] + 0xDC00;
+ yylval->chr = convert(unsigned char, yytext[0]) + 0xDC00;
return REGCHAR;
}