mirror of
https://github.com/frida/tinycc
synced 2024-11-28 10:33:07 +03:00
a number as a field name
a test program: ======== typedef struct X { int len; } X; int main(void) { X myX; myX.10 = 10; return 0; } ======== Error message before a patch: error: ';' expected (got "(null)") After a patch: error: field name expected
This commit is contained in:
parent
eb870b006c
commit
e7e7a0d301
6
tccgen.c
6
tccgen.c
@ -4152,7 +4152,7 @@ ST_FUNC void unary(void)
|
|||||||
if (tok == TOK_INC || tok == TOK_DEC) {
|
if (tok == TOK_INC || tok == TOK_DEC) {
|
||||||
inc(1, tok);
|
inc(1, tok);
|
||||||
next();
|
next();
|
||||||
} else if (tok == '.' || tok == TOK_ARROW) {
|
} else if (tok == '.' || tok == TOK_ARROW || tok == TOK_CDOUBLE) {
|
||||||
int qualifiers;
|
int qualifiers;
|
||||||
/* field */
|
/* field */
|
||||||
if (tok == TOK_ARROW)
|
if (tok == TOK_ARROW)
|
||||||
@ -4160,10 +4160,12 @@ ST_FUNC void unary(void)
|
|||||||
qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
|
qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
|
||||||
test_lvalue();
|
test_lvalue();
|
||||||
gaddrof();
|
gaddrof();
|
||||||
next();
|
|
||||||
/* expect pointer on structure */
|
/* expect pointer on structure */
|
||||||
if ((vtop->type.t & VT_BTYPE) != VT_STRUCT)
|
if ((vtop->type.t & VT_BTYPE) != VT_STRUCT)
|
||||||
expect("struct or union");
|
expect("struct or union");
|
||||||
|
if (tok == TOK_CDOUBLE)
|
||||||
|
expect("field name");
|
||||||
|
next();
|
||||||
s = vtop->type.ref;
|
s = vtop->type.ref;
|
||||||
/* find field */
|
/* find field */
|
||||||
tok |= SYM_FIELD;
|
tok |= SYM_FIELD;
|
||||||
|
Loading…
Reference in New Issue
Block a user