ref: 7ab5856146a046a2f8a2fedd19375a23be1690f2
parent: c41400e10b2d33c1b1e5d1900add4cd17b34c7f0
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Jul 8 10:32:10 EDT 2014
Remove gotos in newfield These gotos were used only for saving some bytes in error handling. This version removes this optimization and makes the code cleaner.
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -260,15 +260,15 @@
{
register Field *p, *q;
register char *s, *t;
- static char *err;
s = sym->name;
for (q = p = tp->u.fields; p; q = p, p = p->next) {
t = p->name;
if (*s == *t && !strcmp(s, t))
- goto duplicated_name;
+ error("duplicated fields '%s' and '%s'", s, t);
if (sym->u.i == p->id)
- goto duplicated_value;
+ error("duplicated enumeration fields '%s' and '%s'",
+ s, t);
}
p = xmalloc(sizeof(*p));
@@ -282,14 +282,6 @@
q->next = p;
return;
-
-duplicated_name:
- err = "duplicated fields '%s' and '%s'";
- goto error;
-duplicated_value:
- err = "duplicated enumeration fields '%s' and '%s'";
-error:
- error(err, s, t);
}
static void