comment parsing fix - bitfields partial fix

This commit is contained in:
bellard 2004-10-02 13:48:50 +00:00
parent 8da2d689df
commit 22d8df96c6

15
tcc.c
View file

@ -1823,9 +1823,14 @@ static uint8_t *parse_line_comment(uint8_t *p)
p++;
for(;;) {
c = *p;
redo:
if (c == '\n' || c == CH_EOF) {
break;
} else if (c == '\\') {
file->buf_ptr = p;
c = handle_eob();
p = file->buf_ptr;
if (c == '\\') {
PEEKC_EOB(c, p);
if (c == '\n') {
file->line_num++;
@ -1837,6 +1842,9 @@ static uint8_t *parse_line_comment(uint8_t *p)
PEEKC_EOB(c, p);
}
}
} else {
goto redo;
}
} else {
p++;
}
@ -5430,7 +5438,7 @@ void force_charshort_cast(int t)
}
}
/* cast 'vtop' to 'type' */
/* cast 'vtop' to 'type'. Casting to bitfields is forbidden. */
static void gen_cast(CType *type)
{
int sbt, dbt, sf, df, c;
@ -5443,6 +5451,11 @@ static void gen_cast(CType *type)
force_charshort_cast(vtop->type.t);
}
/* bitfields first get cast to ints */
if (vtop->type.t & VT_BITFIELD) {
gv(RC_INT);
}
dbt = type->t & (VT_BTYPE | VT_UNSIGNED);
sbt = vtop->type.t & (VT_BTYPE | VT_UNSIGNED);