[hackers] [scc] [cc1] namespacing the flags. move bitfields in node to a flag. || rain1_AT_openmailbox.org

From: <git_AT_suckless.org>
Date: Sun, 8 May 2016 20:30:13 +0200 (CEST)

commit 273930569896197f1823f4912af4537c9c693cc0
Author: rain1_AT_openmailbox.org <rain1_AT_openmailbox.org>
AuthorDate: Fri May 6 19:42:07 2016 +0100
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Sat May 7 18:31:26 2016 +0200

    [cc1] namespacing the flags. move bitfields in node to a flag.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index a9fcfe2..f1e1750 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -82,8 +82,7 @@ struct node {
         unsigned char op;
         Type *type;
         Symbol *sym;
- bool lvalue : 1;
- bool constant : 1;
+ char flags;
         struct node *left, *right;
 };
 
_AT_@ -163,22 +162,29 @@ enum {
 
 /* symbol flags */
 enum {
- ISAUTO = 1,
- ISREGISTER = 2,
- ISDECLARED = 4,
- ISFIELD = 8,
- ISEXTERN = 16,
- ISUSED = 32,
- ISCONSTANT = 64,
- ISGLOBAL = 128,
- ISPRIVATE = 256,
- ISLOCAL = 512,
- ISEMITTED = 1024,
- ISDEFINED = 2048,
- ISSTRING = 4096,
- ISTYPEDEF = 8192,
- ISINITLST = 16384,
- HASINIT = 32768
+ SAUTO = 1,
+ SREGISTER = 2,
+ SDECLARED = 4,
+ SFIELD = 8,
+ SEXTERN = 16,
+ SUSED = 32,
+ SCONSTANT = 64,
+ SGLOBAL = 128,
+ SPRIVATE = 256,
+ SLOCAL = 512,
+ SEMITTED = 1024,
+ SDEFINED = 2048,
+ SSTRING = 4096,
+ STYPEDEF = 8192,
+ SINITLST = 16384,
+ SHASINIT = 32768
+};
+
+/* node flags */
+enum {
+ NLVAL = 1,
+ NCONST = 2,
+ NEFFECT = 4
 };
 
 /* lexer mode, compiler or preprocessor directive */
diff --git a/cc1/code.c b/cc1/code.c
index fd0fe91..5e54a4b 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -168,17 +168,17 @@ emitvar(Symbol *sym)
         char c;
         short flags = sym->flags;
 
- if (flags & ISLOCAL)
+ if (flags & SLOCAL)
                 c = 'T';
- else if (flags & ISPRIVATE)
+ else if (flags & SPRIVATE)
                 c = 'Y';
- else if (flags & ISGLOBAL)
+ else if (flags & SGLOBAL)
                 c = 'G';
- else if (flags & ISREGISTER)
+ else if (flags & SREGISTER)
                 c = 'R';
- else if (flags & ISFIELD)
+ else if (flags & SFIELD)
                 c = 'M';
- else if (flags & ISEXTERN)
+ else if (flags & SEXTERN)
                 c = 'X';
         else
                 c = 'A';
_AT_@ -213,7 +213,7 @@ emitsym(unsigned op, void *arg)
 {
         Node *np = arg;
 
- if ((np->sym->flags & ISINITLST) == 0) {
+ if ((np->sym->flags & SINITLST) == 0) {
                 /*
                  * When we have a compound literal we are going
                  * to call to emitnode for every element of it,
_AT_@ -222,7 +222,7 @@ emitsym(unsigned op, void *arg)
                  */
                 putchar('\t');
         }
- (np->constant) ? emitconst(np) : emitvar(np->sym);
+ (np->flags & NCONST) ? emitconst(np) : emitvar(np->sym);
 }
 
 static void
_AT_@ -324,11 +324,11 @@ emitdesig(Node *np, Type *tp)
                 if (!np->sym)
                         goto emit_expression;
                 sym = np->sym;
- if (sym->flags & ISSTRING) {
+ if (sym->flags & SSTRING) {
                         emitstring(sym, tp);
                         return;
                 }
- if ((sym->flags & ISINITLST) == 0)
+ if ((sym->flags & SINITLST) == 0)
                         goto emit_expression;
         }
 
_AT_@ -378,7 +378,7 @@ emitdcl(unsigned op, void *arg)
 {
         Symbol *sym = arg;
 
- if (sym->flags & ISEMITTED)
+ if (sym->flags & SEMITTED)
                 return;
         emittype(sym->type);
         emitvar(sym);
_AT_@ -389,10 +389,10 @@ emitdcl(unsigned op, void *arg)
         }
         emitletter(sym->type);
         printf("\t\"%s", (sym->name) ? sym->name : "");
- if (sym->flags & ISFIELD)
+ if (sym->flags & SFIELD)
                 printf("\t#%c%llX", sizettype->letter, sym->u.i);
- sym->flags |= ISEMITTED;
- if ((sym->flags & HASINIT) == 0)
+ sym->flags |= SEMITTED;
+ if ((sym->flags & SHASINIT) == 0)
                 putchar('\n');
 }
 
_AT_@ -467,7 +467,7 @@ node(unsigned op, Type *tp, Node *lp, Node *rp)
         np->op = op;
         np->type = tp;
         np->sym = NULL;
- np->constant = np->lvalue = 0;
+ np->flags = 0;
         np->left = lp;
         np->right = rp;
 
_AT_@ -482,8 +482,7 @@ varnode(Symbol *sym)
 
         np = node(OSYM, sym->type, NULL, NULL);
         np->type = sym->type;
- np->lvalue = tp->op != FTN && tp->op != ARY;
- np->constant = 0;
+ np->flags = (tp->op != FTN && tp->op != ARY) ? NLVAL : 0;
         np->sym = sym;
         return np;
 }
_AT_@ -495,7 +494,7 @@ constnode(Symbol *sym)
 
         np = node(OSYM, sym->type, NULL, NULL);
         np->type = sym->type;
- np->constant = 1;
+ np->flags = NCONST;
         np->sym = sym;
         return np;
 }
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 117c366..3707a46 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -93,7 +93,7 @@ nextcpp(void)
                 error("argument overflow invoking macro \"%s\"",
                       macroname);
         if (yytoken == IDEN)
- yylval.sym->flags |= ISUSED;
+ yylval.sym->flags |= SUSED;
         memcpy(argp, yytext, yylen);
         argp += yylen;
         *argp++ = ' ';
_AT_@ -235,7 +235,7 @@ expand(char *begin, Symbol *sym)
         char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[BUFSIZE];
 
         macroname = sym->name;
- if ((sym->flags & ISDECLARED) == 0) {
+ if ((sym->flags & SDECLARED) == 0) {
                 if (namespace == NS_CPP && !strcmp(sym->name, "defined"))
                         return 0; /* we found a 'defined in an #if */
                 /*
_AT_@ -283,7 +283,7 @@ substitute:
 
         input->p = input->begin = begin;
 
- if (!(sym->flags & ISDECLARED))
+ if (!(sym->flags & SDECLARED))
                 killsym(sym);
 
         return 1;
_AT_@ -312,7 +312,7 @@ getpars(Symbol *args[NR_MACROARG])
                         return NR_MACROARG;
                 }
                 sym = install(NS_IDEN, yylval.sym);
- sym->flags |= ISUSED;
+ sym->flags |= SUSED;
                 args[n++] = sym;
                 next();
         } while (accept(','));
_AT_@ -390,12 +390,12 @@ define(void)
                 return;
         }
         sym = yylval.sym;
- if (sym->flags & ISDECLARED) {
+ if (sym->flags & SDECLARED) {
                 warn("'%s' redefined", yytext);
                 free(sym->u.s);
         } else {
                 sym = install(NS_CPP, sym);
- sym->flags |= ISDECLARED|ISSTRING;
+ sym->flags |= SDECLARED|SSTRING;
         }
 
         namespace = NS_IDEN; /* Avoid polution in NS_CPP */
_AT_@ -583,7 +583,7 @@ ifclause(int negate, int isifdef)
                 }
                 sym = yylval.sym;
                 next();
- status = (sym->flags & ISDECLARED) != 0;
+ status = (sym->flags & SDECLARED) != 0;
                 if (!status)
                         killsym(sym);
         } else {
diff --git a/cc1/decl.c b/cc1/decl.c
index f82e996..3ee3cf4 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -151,10 +151,10 @@ parameter(struct decl *dcl)
                 errorp("bad storage class in function parameter");
                 break;
         case REGISTER:
- flags |= ISREGISTER;
+ flags |= SREGISTER;
                 break;
         case NOSCLASS:
- flags |= ISAUTO;
+ flags |= SAUTO;
                 break;
         }
 
_AT_@ -191,7 +191,7 @@ parameter(struct decl *dcl)
         }
 
         sym->type = tp;
- sym->flags &= ~(ISAUTO|ISREGISTER);
+ sym->flags &= ~(SAUTO|SREGISTER);
         sym->flags |= flags;
         return sym;
 }
_AT_@ -213,7 +213,7 @@ krfun(Type *tp, Type *types[], Symbol *syms[], int *ntypes, int *nsyms)
                         sym = yylval.sym;
                         expect(IDEN);
                         sym->type = inttype;
- sym->flags |= ISAUTO;
+ sym->flags |= SAUTO;
                         if ((sym = install(NS_IDEN, sym)) == NULL) {
                                 errorp("redefinition of parameter '%s'",
                                        yylval.sym->name);
_AT_@ -470,7 +470,7 @@ newtag(void)
         case IDEN:
         case TYPEIDEN:
                 sym = yylval.sym;
- if ((sym->flags & ISDECLARED) == 0)
+ if ((sym->flags & SDECLARED) == 0)
                         install(NS_TAG, yylval.sym);
                 namespace = NS_IDEN;
                 next();
_AT_@ -581,7 +581,7 @@ enumdcl(void)
                                yytext);
                 } else {
                         sym->u.i = val;
- sym->flags |= ISCONSTANT;
+ sym->flags |= SCONSTANT;
                         sym->type = inttype;
                 }
                 if (!accept(','))
_AT_@ -638,7 +638,7 @@ field(struct decl *dcl)
                 error("duplicated member '%s'", name);
         sym->type = tp;
 
- sym->flags |= ISFIELD;
+ sym->flags |= SFIELD;
         if (n == NR_FIELDS)
                 error("too much fields in struct/union");
         DBG("New field '%s' in namespace %d\n", name, structp->ns);
_AT_@ -675,7 +675,7 @@ redcl(Symbol *sym, Type *tp, Symbol **pars, int sclass)
         }
         if (curctx != GLOBALCTX && tp->op != FTN) {
                 /* is it the redeclaration of a local variable? */
- if ((sym->flags & ISEXTERN) && sclass == EXTERN)
+ if ((sym->flags & SEXTERN) && sclass == EXTERN)
                         return sym;
                 goto redeclaration;
         }
_AT_@ -689,9 +689,9 @@ redcl(Symbol *sym, Type *tp, Symbol **pars, int sclass)
                 bad_storage(tp, name);
                 break;
         case NOSCLASS:
- if ((flags & ISPRIVATE) == 0) {
- flags &= ~ISEXTERN;
- flags |= ISGLOBAL;
+ if ((flags & SPRIVATE) == 0) {
+ flags &= ~SEXTERN;
+ flags |= SGLOBAL;
                         break;
                 }
                 errorp("non-static declaration of '%s' follows static declaration",
_AT_@ -701,8 +701,8 @@ redcl(Symbol *sym, Type *tp, Symbol **pars, int sclass)
         case EXTERN:
                 break;
         case STATIC:
- if ((flags & (ISGLOBAL|ISEXTERN)) == 0) {
- flags |= ISPRIVATE;
+ if ((flags & (SGLOBAL|SEXTERN)) == 0) {
+ flags |= SPRIVATE;
                         break;
                 }
                 errorp("static declaration of '%s' follows non-static declaration",
_AT_@ -766,24 +766,24 @@ identifier(struct decl *dcl)
                 case REGISTER:
                 case AUTO:
                         if (curctx != GLOBALCTX && tp->op != FTN) {
- flags |= (sclass == REGISTER) ? ISREGISTER : ISAUTO;
+ flags |= (sclass == REGISTER) ? SREGISTER : SAUTO;
                                 break;
                         }
                         bad_storage(tp, name);
                 case NOSCLASS:
                         if (tp->op == FTN)
- flags |= ISEXTERN;
+ flags |= SEXTERN;
                         else
- flags |= (curctx == GLOBALCTX) ? ISGLOBAL : ISAUTO;
+ flags |= (curctx == GLOBALCTX) ? SGLOBAL : SAUTO;
                         break;
                 case EXTERN:
- flags |= ISEXTERN;
+ flags |= SEXTERN;
                         break;
                 case STATIC:
- flags |= (curctx == GLOBALCTX) ? ISPRIVATE : ISLOCAL;
+ flags |= (curctx == GLOBALCTX) ? SPRIVATE : SLOCAL;
                         break;
                 case TYPEDEF:
- flags |= ISTYPEDEF;
+ flags |= STYPEDEF;
                         sym->u.token = sym->token = TYPEIDEN;
                         break;
                 }
_AT_@ -792,8 +792,8 @@ identifier(struct decl *dcl)
 
         if (accept('='))
                 initializer(sym, sym->type);
- if (!(sym->flags & (ISGLOBAL|ISEXTERN)) && tp->op != FTN)
- sym->flags |= ISDEFINED;
+ if (!(sym->flags & (SGLOBAL|SEXTERN)) && tp->op != FTN)
+ sym->flags |= SDEFINED;
         if (sym->token == IDEN && sym->type->op != FTN)
                 emit(ODECL, sym);
         return sym;
_AT_@ -852,7 +852,7 @@ decl(void)
                  * avoid non used warnings in prototypes
                  */
                 for (p = sym->u.pars; p && *p; ++p)
- (*p)->flags |= ISUSED;
+ (*p)->flags |= SUSED;
                 popctx();
                 expect(';');
                 free(sym->u.pars);
_AT_@ -867,17 +867,17 @@ decl(void)
                 }
         }
 
- if (sym->flags & ISTYPEDEF)
+ if (sym->flags & STYPEDEF)
                 errorp("function definition declared 'typedef'");
- if (sym->flags & ISDEFINED)
+ if (sym->flags & SDEFINED)
                 errorp("redefinition of '%s'", sym->name);
- if (sym->flags & ISEXTERN) {
- sym->flags &= ~ISEXTERN;
- sym->flags |= ISGLOBAL;
+ if (sym->flags & SEXTERN) {
+ sym->flags &= ~SEXTERN;
+ sym->flags |= SGLOBAL;
         }
 
- sym->flags |= ISDEFINED;
- sym->flags &= ~ISEMITTED;
+ sym->flags |= SDEFINED;
+ sym->flags &= ~SEMITTED;
         emit(OFUN, sym);
         compound(NULL, NULL, NULL);
         emit(OEFUN, NULL);
diff --git a/cc1/expr.c b/cc1/expr.c
index 6983591..bbd3385 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -18,7 +18,7 @@ cmpnode(Node *np, TUINT val)
         Type *tp;
         TUINT mask, nodeval;
 
- if (!np || !np->constant || !np->sym)
+ if (!np || !(np->flags & NCONST) || !np->sym)
                 return 0;
         sym = np->sym;
         tp = sym->type;
_AT_@ -130,7 +130,7 @@ set_p1_p2:
 static int
 null(Node *np)
 {
- if (!np->constant || np->type != pvoidtype)
+ if (!np->flags & NCONST || np->type != pvoidtype)
                 return 0;
         return cmpnode(np, 0);
 }
_AT_@ -191,7 +191,7 @@ wrong_type:
 static void
 chklvalue(Node *np)
 {
- if (!np->lvalue)
+ if (!(np->flags & NLVAL))
                 errorp("lvalue required in operation");
         if (np->type == voidtype)
                 errorp("invalid use of void expression");
_AT_@ -214,8 +214,8 @@ decay(Node *np)
                 }
         case FTN:
                 new = node(OADDR, mktype(tp, PTR, 0, NULL), np, NULL);
- if (np->sym && np->sym->flags & (ISGLOBAL|ISLOCAL|ISPRIVATE))
- new->constant = 1;
+ if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new->flags |= NCONST;
                 return new;
         default:
                 return np;
_AT_@ -462,12 +462,12 @@ field(Node *np)
                       yylval.sym->name);
                 goto free_np;
         }
- if ((sym->flags & ISDECLARED) == 0) {
+ if ((sym->flags & SDECLARED) == 0) {
                 errorp("incorrect field in struct/union");
                 goto free_np;
         }
         np = node(OFIELD, sym->type, np, varnode(sym));
- np->lvalue = 1;
+ np->flags |= NLVAL;
         return np;
 
 free_np:
_AT_@ -491,7 +491,7 @@ content(char op, Node *np)
                 } else {
                         np = node(op, np->type->type, np, NULL);
                 }
- np->lvalue = 1;
+ np->flags |= NLVAL;
                 return np;
         default:
                 error("invalid argument of memory indirection");
_AT_@ -553,7 +553,7 @@ address(char op, Node *np)
 
         if (BTYPE(np) != FTN) {
                 chklvalue(np);
- if (np->sym && (np->sym->flags & ISREGISTER))
+ if (np->sym && (np->sym->flags & SREGISTER))
                         errorp("address of register variable '%s' requested", yytext);
                 if (np->op == OPTR) {
                         Node *new = np->left;
_AT_@ -563,8 +563,8 @@ address(char op, Node *np)
         }
         new = node(op, mktype(np->type, PTR, 0, NULL), np, NULL);
 
- if (np->sym && np->sym->flags & (ISGLOBAL|ISLOCAL|ISPRIVATE))
- new->constant = 1;
+ if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new->flags |= NCONST;
         return new;
 }
 
_AT_@ -593,10 +593,10 @@ notdefined(Symbol *sym)
                 expect(IDEN);
                 expect(')');
 
- isdef = (sym->flags & ISDECLARED) != 0;
+ isdef = (sym->flags & SDECLARED) != 0;
                 sym = newsym(NS_IDEN);
                 sym->type = inttype;
- sym->flags |= ISCONSTANT;
+ sym->flags |= SCONSTANT;
                 sym->u.i = isdef;
                 disexpand = 0;
                 return sym;
_AT_@ -619,7 +619,7 @@ primary(void)
         switch (yytoken) {
         case STRING:
                 np = constnode(sym);
- sym->flags |= HASINIT;
+ sym->flags |= SHASINIT;
                 emit(ODECL, sym);
                 emit(OINIT, np);
                 np = decay(varnode(sym));
_AT_@ -630,13 +630,13 @@ primary(void)
                 next();
                 break;
         case IDEN:
- if ((sym->flags & ISDECLARED) == 0)
+ if ((sym->flags & SDECLARED) == 0)
                         sym = notdefined(sym);
- if (sym->flags & ISCONSTANT) {
+ if (sym->flags & SCONSTANT) {
                         np = constnode(sym);
                         break;
                 }
- sym->flags |= ISUSED;
+ sym->flags |= SUSED;
                 np = varnode(sym);
                 next();
                 break;
_AT_@ -840,7 +840,8 @@ cast(void)
                         lp = cast();
                         if ((rp = convert(lp, tp, 1)) == NULL)
                                 error("bad type convertion requested");
- rp->lvalue = lp->lvalue;
+ rp->flags &= ~NLVAL;
+ rp->flags |= lp->flags & NLVAL;
                 }
                 break;
         default:
_AT_@ -1058,7 +1059,7 @@ constexpr(void)
         Node *np;
 
         np = ternary();
- if (!np->constant) {
+ if (!(np->flags & NCONST)) {
                 freetree(np);
                 return NULL;
         }
_AT_@ -1101,7 +1102,7 @@ condexpr(void)
         Node *np;
 
         np = exp2cond(expr(), 0);
- if (np->constant)
+ if (np->flags & NCONST)
                 warn("conditional expression is constant");
         return np;
 }
diff --git a/cc1/fold.c b/cc1/fold.c
index 429e5e5..dfcfa05 100644
--- a/cc1/fold.c
+++ b/cc1/fold.c
_AT_@ -324,8 +324,8 @@ fold(int op, Type *tp, Node *lp, Node *rp)
          * (when we don't know the physical address so
          * we cannot fold it)
          */
- if (!lp->constant || !lp->sym ||
- rp && (!rp->constant || !rp->sym)) {
+ if (!(lp->flags & NCONST) || !lp->sym ||
+ rp && (!(rp->flags & NCONST) || !rp->sym)) {
                 return NULL;
         }
         optype = lp->type;
_AT_@ -355,7 +355,7 @@ commutative(int *op, Node **lp, Node **rp)
 {
         Node *l = *lp, *r = *rp, *aux;
 
- if (r == NULL || r->constant || !l->constant)
+ if (r == NULL || r->flags & NCONST || !(l->flags & NCONST))
                 return;
 
         switch (*op) {
_AT_@ -391,10 +391,10 @@ identity(int *op, Node *lp, Node *rp)
 
         iszeror = cmpnode(rp, 0);
         isoner = cmpnode(rp, 1),
- istruer = !iszeror && rp->constant;
+ istruer = !iszeror && rp->flags & NCONST;
         iszerol = cmpnode(lp, 0);
         isonel = cmpnode(lp, 1),
- istruel = !iszerol && lp->constant;
+ istruel = !iszerol && lp->flags & NCONST;
 
         switch (*op) {
         case OOR:
_AT_@ -495,7 +495,7 @@ foldternary(int op, Type *tp, Node *cond, Node *body)
 {
         Node *np;
 
- if (!cond->constant)
+ if (!(cond->flags & NCONST))
                 return node(op, tp, cond, body);
         if (cmpnode(cond, 0)) {
                 np = body->right;
_AT_@ -538,7 +538,7 @@ castcode(Node *np, Type *newtp)
         Type *oldtp = np->type;
         Symbol aux, *sym, *osym = np->sym;
 
- if (!np->constant)
+ if (!(np->flags & NCONST))
                 goto noconstant;
 
         switch (newtp->op) {
diff --git a/cc1/init.c b/cc1/init.c
index 2464bbd..9245ec8 100644
--- a/cc1/init.c
+++ b/cc1/init.c
_AT_@ -65,7 +65,7 @@ fielddesig(Init *ip)
         if (yytoken != IDEN)
                 unexpected();
         sym = yylval.sym;
- if ((sym->flags & ISDECLARED) == 0) {
+ if ((sym->flags & SDECLARED) == 0) {
                 errorp(" unknown field '%s' specified in initializer",
                       sym->name);
                 return 0;
_AT_@ -175,7 +175,7 @@ mkcompound(Init *ip)
         sym = newsym(NS_IDEN);
         sym->u.init = v;
         sym->type = ip->type;
- sym->flags |= ISINITLST;
+ sym->flags |= SINITLST;
 
         return constnode(sym);
 }
_AT_@ -300,21 +300,21 @@ initializer(Symbol *sym, Type *tp)
         }
         np = initialize(tp);
 
- if (flags & ISDEFINED) {
+ if (flags & SDEFINED) {
                 errorp("redeclaration of '%s'", sym->name);
- } else if ((flags & (ISGLOBAL|ISLOCAL|ISPRIVATE)) != 0) {
- if (!np->constant) {
+ } else if ((flags & (SGLOBAL|SLOCAL|SPRIVATE)) != 0) {
+ if (!(np->flags & NCONST)) {
                         errorp("initializer element is not constant");
                         return;
                 }
- sym->flags |= HASINIT;
- sym->flags &= ~ISEMITTED;
+ sym->flags |= SHASINIT;
+ sym->flags &= ~SEMITTED;
                 emit(ODECL, sym);
                 emit(OINIT, np);
- sym->flags |= ISDEFINED;
- } else if ((flags & (ISEXTERN|ISTYPEDEF)) != 0) {
+ sym->flags |= SDEFINED;
+ } else if ((flags & (SEXTERN|STYPEDEF)) != 0) {
                 errorp("'%s' has both '%s' and initializer",
- sym->name, (flags&ISEXTERN) ? "extern" : "typedef");
+ sym->name, (flags&SEXTERN) ? "extern" : "typedef");
         } else {
                 emit(ODECL, sym);
                 np = node(OASSIGN, tp, varnode(sym), np);
diff --git a/cc1/lex.c b/cc1/lex.c
index 935cb40..d21640a 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -341,7 +341,7 @@ convert:
         tp = ctype(INT, sign, size);
         sym = newsym(NS_IDEN);
         sym->type = tp;
- sym->flags |= ISCONSTANT;
+ sym->flags |= SCONSTANT;
         yylval.sym = readint(s, base, sign, sym);
         return CONSTANT;
 }
_AT_@ -513,7 +513,7 @@ iden(void)
                         sym = nextsym(sym, namespace);
         }
         yylval.sym = sym;
- if (sym->flags & ISCONSTANT)
+ if (sym->flags & SCONSTANT)
                 return CONSTANT;
         if (sym->token != IDEN)
                 yylval.token = sym->u.token;
diff --git a/cc1/stmt.c b/cc1/stmt.c
index e9f4b7f..71f11bb 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -21,11 +21,11 @@ label(void)
         case IDEN:
         case TYPEIDEN:
                 sym = lookup(NS_LABEL, yytext);
- if (sym->flags & ISDEFINED)
+ if (sym->flags & SDEFINED)
                         error("label '%s' already defined", yytext);
- if ((sym->flags & ISDECLARED) == 0)
+ if ((sym->flags & SDECLARED) == 0)
                         sym = install(NS_LABEL, sym);
- sym->flags |= ISDEFINED;
+ sym->flags |= SDEFINED;
                 emit(OLABEL, sym);
                 next();
                 expect(':');
_AT_@ -195,9 +195,9 @@ Goto(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
         if (yytoken != IDEN)
                 unexpected();
         sym = yylval.sym;
- if ((sym->flags & ISDECLARED) == 0)
+ if ((sym->flags & SDECLARED) == 0)
                 sym = install(NS_LABEL, sym);
- sym->flags |= ISUSED;
+ sym->flags |= SUSED;
         emit(OJUMP, sym);
         next();
         expect(';');
diff --git a/cc1/symbol.c b/cc1/symbol.c
index a1695c8..8d540a4 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -58,7 +58,7 @@ unlinkhash(Symbol *sym)
 {
         Symbol **h, *p, *prev;
 
- if ((sym->flags & ISDECLARED) == 0)
+ if ((sym->flags & SDECLARED) == 0)
                 return;
         h = &htab[hash(sym->name)];
         for (prev = p = *h; p != sym; prev = p, p = p->hash)
_AT_@ -83,15 +83,15 @@ killsym(Symbol *sym)
         char *name;
 
         f = sym->flags;
- if (f & ISSTRING)
+ if (f & SSTRING)
                 free(sym->u.s);
         if (sym->ns == NS_TAG)
                 sym->type->defined = 0;
         unlinkhash(sym);
         if ((name = sym->name) != NULL && sym->ns != NS_CPP) {
- if ((f & (ISUSED|ISGLOBAL|ISDECLARED)) == ISDECLARED)
+ if ((f & (SUSED|SGLOBAL|SDECLARED)) == SDECLARED)
                         warn("'%s' defined but not used", name);
- if ((f & ISDEFINED) == 0 && sym->ns == NS_LABEL)
+ if ((f & SDEFINED) == 0 && sym->ns == NS_LABEL)
                         errorp("label '%s' is not defined", name);
         }
         free(name);
_AT_@ -216,7 +216,7 @@ linkhash(Symbol *sym)
 
         if (sym->ns != NS_CPP)
                 sym->id = newid();
- sym->flags |= ISDECLARED;
+ sym->flags |= SDECLARED;
         return linksym(sym);
 }
 
_AT_@ -232,7 +232,7 @@ newstring(char *s, size_t len)
         Symbol *sym = newsym(NS_IDEN);
 
         sym->id = newid();
- sym->flags |= ISSTRING | ISCONSTANT | ISPRIVATE;
+ sym->flags |= SSTRING | SCONSTANT | SPRIVATE;
         sym->u.s = xmalloc(len);
         if (s)
                 memcpy(sym->u.s, s, len);
_AT_@ -276,7 +276,7 @@ lookup(int ns, char *name)
                 if (ns == NS_CPP)
                         continue;
                 if (sns == NS_KEYWORD ||
- (sym->flags & ISTYPEDEF) && ns >= NS_STRUCTS) {
+ (sym->flags & STYPEDEF) && ns >= NS_STRUCTS) {
                         return sym;
                 }
         }
_AT_@ -308,7 +308,7 @@ nextsym(Symbol *sym, int ns)
 Symbol *
 install(int ns, Symbol *sym)
 {
- if (sym->flags & ISDECLARED) {
+ if (sym->flags & SDECLARED) {
                 if (sym->ctx == curctx && ns == sym->ns)
                         return NULL;
                 sym = allocsym(ns, sym->name);
Received on Sun May 08 2016 - 20:30:13 CEST

This archive was generated by hypermail 2.3.0 : Sun May 08 2016 - 20:36:19 CEST