[hackers] [scc] [cc1] Remove macro in field() || Quentin Carbonneaux

From: <git_AT_suckless.org>
Date: Fri, 9 Dec 2016 23:15:14 +0100 (CET)

commit 47eff6965a28547891e871c7f499bee5d396ef25
Author: Quentin Carbonneaux <quentin_AT_c9x.me>
AuthorDate: Fri Dec 9 17:15:10 2016 -0500
Commit: Quentin Carbonneaux <quentin_AT_c9x.me>
CommitDate: Fri Dec 9 17:15:10 2016 -0500

    [cc1] Remove macro in field()

diff --git a/cc1/decl.c b/cc1/decl.c
index b314c6f..c37b6ca 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -609,12 +609,12 @@ type(struct decl *dcl)
         return sym;
 }
 
-#define NAME(s) (*(s)->name ? (s)->name : "<anonymous>")
 static Symbol *
 field(struct decl *dcl)
 {
+ static char *anon = "<anonymous>";
         Symbol *sym = dcl->sym;
- char *name = sym->name;
+ char *name = *sym->name ? sym->name : anon;
         Type *structp = dcl->parent, *tp = dcl->type;
         TINT n = structp->n.elem;
         int err = 0;
_AT_@ -631,14 +631,14 @@ field(struct decl *dcl)
                         n = np->sym->u.i;
                         freetree(np);
                 }
- if (n == 0 && *sym->name)
- errorp("zero width for bit-field '%s'", sym->name);
+ if (n == 0 && name != anon)
+ errorp("zero width for bit-field '%s'", name);
                 if (tp != booltype && tp != inttype && tp != uinttype)
- errorp("bit-field '%s' has invalid type", NAME(sym));
+ errorp("bit-field '%s' has invalid type", name);
                 if (n < 0)
- errorp("negative width in bit-field '%s'", NAME(sym));
+ errorp("negative width in bit-field '%s'", name);
                 else if (n > tp->size*8)
- errorp("width of '%s' exceeds its type", NAME(sym));
+ errorp("width of '%s' exceeds its type", name);
         } else if (empty(sym, tp, 0)) {
                 return sym;
         }
_AT_@ -672,7 +672,6 @@ field(struct decl *dcl)
 
         return sym;
 }
-#undef NAME
 
 static void
 bad_storage(Type *tp, char *name)
Received on Fri Dec 09 2016 - 23:15:14 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 09 2016 - 23:24:16 CET