comment parsing fix - bitfields partial fix
This commit is contained in:
parent
8da2d689df
commit
22d8df96c6
1 changed files with 20 additions and 7 deletions
25
tcc.c
25
tcc.c
|
@ -1823,19 +1823,27 @@ static uint8_t *parse_line_comment(uint8_t *p)
|
||||||
p++;
|
p++;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
c = *p;
|
c = *p;
|
||||||
|
redo:
|
||||||
if (c == '\n' || c == CH_EOF) {
|
if (c == '\n' || c == CH_EOF) {
|
||||||
break;
|
break;
|
||||||
} else if (c == '\\') {
|
} else if (c == '\\') {
|
||||||
PEEKC_EOB(c, p);
|
file->buf_ptr = p;
|
||||||
if (c == '\n') {
|
c = handle_eob();
|
||||||
file->line_num++;
|
p = file->buf_ptr;
|
||||||
PEEKC_EOB(c, p);
|
if (c == '\\') {
|
||||||
} else if (c == '\r') {
|
|
||||||
PEEKC_EOB(c, p);
|
PEEKC_EOB(c, p);
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
file->line_num++;
|
file->line_num++;
|
||||||
PEEKC_EOB(c, p);
|
PEEKC_EOB(c, p);
|
||||||
|
} else if (c == '\r') {
|
||||||
|
PEEKC_EOB(c, p);
|
||||||
|
if (c == '\n') {
|
||||||
|
file->line_num++;
|
||||||
|
PEEKC_EOB(c, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
goto redo;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p++;
|
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)
|
static void gen_cast(CType *type)
|
||||||
{
|
{
|
||||||
int sbt, dbt, sf, df, c;
|
int sbt, dbt, sf, df, c;
|
||||||
|
@ -5443,6 +5451,11 @@ static void gen_cast(CType *type)
|
||||||
force_charshort_cast(vtop->type.t);
|
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);
|
dbt = type->t & (VT_BTYPE | VT_UNSIGNED);
|
||||||
sbt = vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
|
sbt = vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue