commit fdbaed739f4eb78f65514764b87fb87834b76ed3 parent 06c8e5d1ac23831304404343c9f07110540ae354 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Tue, 18 Mar 2014 07:52:16 +0100 Unify errors calls in extdcl Diffstat:
M | decl.c | | | 13 | ++++++++++--- |
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/decl.c b/decl.c @@ -461,6 +461,7 @@ extdecl(void) int8_t sclass; struct symbol *sym; extern struct symbol *curfun; + char *err; forbid_eof = 1; @@ -468,12 +469,11 @@ extdecl(void) case IDEN: TYPE: case SCLASS: case TQUALIFIER: tp = specifier(&sclass); if (sclass == REGISTER || sclass == AUTO) - error("incorrect storage class for file-scope declaration"); - break; + goto bad_storage; case ';': break; default: - error("declaration expected"); + goto dcl_expected; } if (yytoken != ';') { @@ -497,4 +497,11 @@ extdecl(void) forbid_eof = 0; expect(';'); return NULL; + +bad_storage: + err = "incorrect storage class for file-scope declaration"; + goto error; +dcl_expected: + err = "declaration expected"; +error: error(err); }