scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 5eb6c9dd70e390d3a92f27b40d4d0cb7aa0ae03e
parent f883b8ec98db46ad0d718ab8618fcafe39ec6278
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 28 May 2014 14:05:56 +0200

Remove some unneded gotos

These gotos are not needed at all, and they can be substituted by
direct call to exit.

Diffstat:
Mcc1/decl.c | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -345,11 +345,8 @@ newtag(uint8_t tag) if (!(tp = sym->type)) tp = sym->type = mktype(NULL, tag, 0); if (tp->op != tag) - goto bad_tag; + error("'%s' defined as wrong kind of tag", yytext); return tp; - -bad_tag: - error("'%s' defined as wrong kind of tag", yytext); } static Type * @@ -363,16 +360,13 @@ structdcl(void) tp = newtag(tag); if (accept('{')) { if (tp->defined) - goto redefined; + error("redefinition of struct/union '%s'", yytext); tp->defined = 1; while (!accept('}')) fielddcl(tp); } return tp; - -redefined: - error("redefinition of struct/union '%s'", yytext); } static Type *