scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit c863f70762d5c00224431259e92b0eb5114b2b61
parent a639f3f1bf3ee7a1645eddac929afc4a253e0c84
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 18 Jun 2022 09:15:20 +0200

cc1: Accept casts in sizeof expressions

Casts can be used in sizeof expressions and it means that
we have to call to cast() instead of calling unary() in
sizeexp().

Diffstat:
Msrc/cmd/cc/cc1/expr.c | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/cmd/cc/cc1/expr.c b/src/cmd/cc/cc1/expr.c @@ -739,8 +739,6 @@ no_pars: return node(op, rettype, np, par); } -static Node *unary(void); - static Type * typeof(Node *np) { @@ -759,6 +757,8 @@ typeof(Node *np) return tp; } +static Node *cast(void); + static Type * sizeexp(void) { @@ -771,7 +771,7 @@ sizeexp(void) tp = typename(); break; default: - tp = typeof(unary()); + tp = typeof(cast()); break; } expect(')'); @@ -814,8 +814,6 @@ postfix(Node *lp) } } -static Node *cast(void); - static Node * unary(void) {