diff options
| author | bellard <bellard> | 2004-10-02 13:48:50 +0000 |
|---|---|---|
| committer | bellard <bellard> | 2004-10-02 13:48:50 +0000 |
| commit | 22d8df96c60204c18c096fec903a4d807c386dcd (patch) | |
| tree | 5f8c1b2015b16c66333e1072ec5f193be7fb0b93 | |
| parent | 8da2d689df532900090365a609cdbe3a155f53f9 (diff) | |
| download | tinycc-22d8df96c60204c18c096fec903a4d807c386dcd.tar.gz tinycc-22d8df96c60204c18c096fec903a4d807c386dcd.tar.bz2 | |
comment parsing fix - bitfields partial fix
| -rw-r--r-- | tcc.c | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -1823,19 +1823,27 @@ static uint8_t *parse_line_comment(uint8_t *p) p++; for(;;) { c = *p; + redo: if (c == '\n' || c == CH_EOF) { break; } else if (c == '\\') { - PEEKC_EOB(c, p); - if (c == '\n') { - file->line_num++; - PEEKC_EOB(c, p); - } else if (c == '\r') { + file->buf_ptr = p; + c = handle_eob(); + p = file->buf_ptr; + if (c == '\\') { PEEKC_EOB(c, p); if (c == '\n') { file->line_num++; 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 { 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; @@ -5442,7 +5450,12 @@ static void gen_cast(CType *type) vtop->r &= ~VT_MUSTCAST; 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); |
