[hackers] [scc] Do not create unneded node in initialization || Roberto E. Vargas Caballero
commit 3f775a9d7d5405a555e5746f3314884ace516a4c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Jan 18 17:48:32 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Jan 18 17:48:32 2016 +0100
Do not create unneded node in initialization
We were dealing initializers in the same way that we dealt
assignations, and this was an error, because in the case
of ibnitializers we do not need any node to mark the kind
of operation.
diff --git a/cc1/init.c b/cc1/init.c
index eb77cd3..eb59365 100644
--- a/cc1/init.c
+++ b/cc1/init.c
_AT_@ -169,12 +169,12 @@ initializer(Symbol *sym, Type *tp, int nelem)
if (tp->op == FTN)
errorp("function '%s' is initialized like a variable", sym->name);
- np = node(OINIT, tp, varnode(sym), initialize(tp));
+ np = initialize(tp);
if (flags & ISDEFINED) {
errorp("redeclaration of '%s'", sym->name);
} else if ((flags & (ISGLOBAL|ISLOCAL|ISPRIVATE)) != 0) {
- if (!np->right->constant)
+ if (!np->constant)
errorp("initializer element is not constant");
emit(OINIT, np);
sym->flags |= ISDEFINED;
_AT_@ -182,7 +182,7 @@ initializer(Symbol *sym, Type *tp, int nelem)
errorp("'%s' has both '%s' and initializer",
sym->name, (flags&ISEXTERN) ? "extern" : "typedef");
} else {
- np->op = OASSIGN;
+ np = node(OASSIGN, tp, varnode(sym), np);
emit(OEXPR, np);
}
}
Received on Mon Jan 18 2016 - 17:51:56 CET
This archive was generated by hypermail 2.3.0
: Mon Jan 18 2016 - 18:00:57 CET