ref: 7611e66c4a272e9e4ada31a6996670298a476dff
parent: f1025f8a2f5817081c096d244d27c08e58090e56
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Nov 4 12:01:05 EDT 2021
cc1: Simplify postfix() The doube switch was only to unify the call to decay(). It is much simpler just to call decay in every case where it is needed.
--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -778,39 +778,32 @@
static Node *
postfix(Node *lp)
{
+ int op;
Node *rp;
for (;;) {
switch (yytoken) {
case '[':
+ next();
+ rp = xexpr();
+ expect(']');
+ lp = array(decay(lp), rp);
+ break;
case DEC:
case INC:
+ op = (yytoken == INC) ? OINC : ODEC;
+ lp = incdec(decay(lp), op);
+ next();
+ break;
+
case INDIR:
+ lp = content(OPTR, decay(lp));
case '.':
+ lp = field(decay(lp));
+ break;
case '(':
- lp = decay(lp);
- switch (yytoken) {
- case '[':
- next();
- rp = xexpr();
- expect(']');
- lp = array(lp, rp);
- break;
- case DEC:
- case INC:
- lp = incdec(lp, (yytoken == INC) ? OINC : ODEC);
- next();
- break;
- case INDIR:
- lp = content(OPTR, lp);
- case '.':
- lp = field(lp);
- break;
- case '(':
- lp = arguments(lp);
- lp->flags |= NEFFECT;
- break;
- }
+ lp = arguments(decay(lp));
+ lp->flags |= NEFFECT;
break;
default:
return lp;