ref: d02dde25b6faa53013cbbb9894f1539645093ee5
parent: 6526c3052cb52d7a55d42444dcda3628be67a44f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Jun 18 04:05:49 EDT 2022
cc1: Simplify address() The use of a few local variables can simplify some of the expressions used in the code.
--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -540,6 +540,8 @@
address(int op, Node *np)
{
Node *new;
+ Type *tp = np->type;
+ Symbol *sym = np->sym;
/*
* ansi c accepts & applied to a function name, and it generates
@@ -546,18 +548,18 @@
* a function pointer
*/
if (np->op == OSYM) {
- if (np->type->op == FTN)
+ if (tp->op == FTN)
return decay(np);
- if (np->type->op == ARY)
+ if (tp->op == ARY)
goto dont_check_lvalue;
}
chklvalue(np);
dont_check_lvalue:
- if (np->sym && (np->sym->flags & SREGISTER))
+ if (sym && (sym->flags & SREGISTER))
errorp("address of register variable '%s' requested", yytext);
- new = node(op, mktype(np->type, PTR, 0, NULL), np, NULL);
- if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new = node(op, mktype(tp, PTR, 0, NULL), np, NULL);
+ if (sym && sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
new->flags |= NCONST;
return new;
}