ref: 40f728bbc37cdce07a2dd000dfa81c0dfe0b307a
parent: 401f843e3fd7dd3399a30d79b1a35f1340909dbe
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 10 11:53:14 EST 2016
Remove indentation level in decl()
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -769,42 +769,37 @@
* 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