History

comment parsing fix - bitfields partial fix

bellard committed 22 years ago

Commit 22d8df91 parent 8da2d681 file · +20 −7Browse files

Unified · Split

tcc.c+20−7
@@ -1823,19 +1823,27 @@ static uint8_t *parse_line_comment(uint8_t *p) · 1822 unmodified lines
1823 p++;1823 p++;
1824 for(;;) {1824 for(;;) {
1825 c = *p;1825 c = *p;
1826 redo:
1826 if (c == '\n' || c == CH_EOF) {1827 if (c == '\n' || c == CH_EOF) {
1827 break;1828 break;
1828 } else if (c == '\\') {1829 } else if (c == '\\') {
1829 PEEKC_EOB(c, p);1830 file->buf_ptr = p;
1830 if (c == '\n') {1831 c = handle_eob();
1831 file->line_num++;1832 p = file->buf_ptr;
1832 PEEKC_EOB(c, p);1833 if (c == '\\') {
1833 } else if (c == '\r') {
1834 PEEKC_EOB(c, p);1834 PEEKC_EOB(c, p);
1835 if (c == '\n') {1835 if (c == '\n') {
1836 file->line_num++;1836 file->line_num++;
1837 PEEKC_EOB(c, p);1837 PEEKC_EOB(c, p);
1838 } else if (c == '\r') {
1839 PEEKC_EOB(c, p);
1840 if (c == '\n') {
1841 file->line_num++;
1842 PEEKC_EOB(c, p);
1843 }
1838 }1844 }
1845 } else {
1846 goto redo;
1839 }1847 }
1840 } else {1848 } else {
1841 p++;1849 p++;
@@ -5430,7 +5438,7 @@ void force_charshort_cast(int t) · 3588 unmodified lines
5430 }5438 }
5431}5439}
5432 5440
5433/* cast 'vtop' to 'type' */5441/* cast 'vtop' to 'type'. Casting to bitfields is forbidden. */
5434static void gen_cast(CType *type)5442static void gen_cast(CType *type)
5435{5443{
5436 int sbt, dbt, sf, df, c;5444 int sbt, dbt, sf, df, c;
@@ -5442,7 +5450,12 @@ static void gen_cast(CType *type) · 5 unmodified lines
5442 vtop->r &= ~VT_MUSTCAST;5450 vtop->r &= ~VT_MUSTCAST;
5443 force_charshort_cast(vtop->type.t);5451 force_charshort_cast(vtop->type.t);
5444 }5452 }
5445 5453
5454 /* bitfields first get cast to ints */
5455 if (vtop->type.t & VT_BITFIELD) {
5456 gv(RC_INT);
5457 }
5458
5446 dbt = type->t & (VT_BTYPE | VT_UNSIGNED);5459 dbt = type->t & (VT_BTYPE | VT_UNSIGNED);
5447 sbt = vtop->type.t & (VT_BTYPE | VT_UNSIGNED);5460 sbt = vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
5448 5461

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t