[hackers] [scc] Remove indentation level in decl() || Roberto E. Vargas Caballero
commit 40f728bbc37cdce07a2dd000dfa81c0dfe0b307a
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jan 10 16:53:14 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jan 10 16:53:14 2016 +0100
Remove indentation level in decl()
diff --git a/cc1/decl.c b/cc1/decl.c
index 7f2e96f..f900ac6 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -769,42 +769,37 @@ decl(void)
* but due to parameter context, we have to check
* against GLOBALCTX+1
*/
- if (sym->type->op == FTN) {
- if (curctx != GLOBALCTX+1)
- goto prototype;
+ if (sym->type->op != FTN) {
+ expect(';');
+ return;
+ }
- switch (yytoken) {
- case '{':
- case TYPEIDEN:
- case TYPE:
- case TQUALIFIER:
- case SCLASS:
- if (sym->flags & ISTYPEDEF)
- errorp("function definition declared 'typedef'");
- if (sym->flags & ISDEFINED)
- errorp("redefinition of '%s'", sym->name);
- if (sym->flags & ISEXTERN) {
- sym->flags &= ~ISEXTERN;
- sym->flags |= ISGLOBAL;
- }
- sym->flags |= ISDEFINED;
- sym->flags &= ~ISEMITTED;
- curfun = sym;
- emit(OFUN, sym);
- free(sym->u.pars);
- compound(NULL, NULL, NULL);
- emit(OEFUN, NULL);
- curfun = NULL;
- return;
- default:
- prototype:
- emit(ODECL, sym);
- free(sym->u.pars);
- sym->u.pars = NULL;
- popctx();
- }
+ if (curctx != GLOBALCTX+1 || yytoken == ';') {
+ /* it is a prototype */
+ emit(ODECL, sym);
+ free(sym->u.pars);
+ sym->u.pars = NULL;
+ popctx();
+ expect(';');
+ return;
}
- expect(';');
+
+ if (sym->flags & ISTYPEDEF)
+ errorp("function definition declared 'typedef'");
+ if (sym->flags & ISDEFINED)
+ errorp("redefinition of '%s'", sym->name);
+ if (sym->flags & ISEXTERN) {
+ sym->flags &= ~ISEXTERN;
+ sym->flags |= ISGLOBAL;
+ }
+ sym->flags |= ISDEFINED;
+ sym->flags &= ~ISEMITTED;
+ curfun = sym;
+ emit(OFUN, sym);
+ free(sym->u.pars);
+ compound(NULL, NULL, NULL);
+ emit(OEFUN, NULL);
+ curfun = NULL;
}
static void
Received on Mon Jan 11 2016 - 10:17:13 CET
This archive was generated by hypermail 2.3.0
: Mon Jan 11 2016 - 10:24:20 CET