scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 9c48f641a47824a9759e93675d4e2e3c60786758
parent 131f1d80c5f93ba7704f3bacdc353636663a645e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 14 Dec 2016 14:56:44 +0100

[cc1] Add symbolic constants for dodcl()

Dodcl() has 4 parameters, and having a 0 or 1 in the first was
not clear at all. These new constants add a bit of information
about the proposal of the parameter.

Diffstat:
Mcc1/decl.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -12,6 +12,10 @@ static char sccsid[] = "@(#) ./cc1/decl.c"; #define NOSCLASS 0 +#define NOREP 0 +#define REP 1 + + struct declarators { unsigned char nr; struct declarator { @@ -257,7 +261,7 @@ ansifun(Type *tp, Type *types[], Symbol *syms[], int *ntypes, int *nsyms) *types++ = ellipsistype; break; } - if ((sym = dodcl(0, parameter, NS_IDEN, tp)) == NULL) + if ((sym = dodcl(NOREP, parameter, NS_IDEN, tp)) == NULL) continue; if (tp->n.elem == -1) { n = -1; @@ -856,7 +860,7 @@ decl(void) if (accept(';')) return; - sym = dodcl(1, identifier, NS_IDEN, NULL); + sym = dodcl(REP, identifier, NS_IDEN, NULL); if (sym->type->op != FTN) { expect(';'); @@ -886,7 +890,7 @@ decl(void) } if (sym->type->prop & TK_R) { while (yytoken != '{') { - par = dodcl(1, parameter, NS_IDEN, sym->type); + par = dodcl(REP, parameter, NS_IDEN, sym->type); expect(';'); } } @@ -913,12 +917,12 @@ static void fieldlist(Type *tp) { if (yytoken != ';') - dodcl(1, field, tp->ns, tp); + dodcl(REP, field, tp->ns, tp); expect(';'); } Type * typename(void) { - return dodcl(0, type, 0, NULL)->type; + return dodcl(NOREP, type, 0, NULL)->type; }