shithub: scc

Download patch

ref: a3e03967a9f98413c65ec14840579f6ab473645f
parent: 31a290d52fdf8258fa8b02aca58f9711890ad853
parent: c16c48b42ad09f42fae6a83be731b9ef34f1f198
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Dec 10 03:37:23 EST 2016

Merge branch 'master' of ssh://suckless.org/gitrepos/scc

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -252,7 +252,7 @@
 		emitletter(tp);
 		putchar('\t');
 		emitletter(tp->type);
-		printf("\t#%c%lld\n",
+		printf("\t#%c%llX\n",
 		       sizettype->letter, (long long) tp->n.elem);
 		return;
 	case PTR:
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -609,12 +609,12 @@
 	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;
@@ -631,14 +631,14 @@
 			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;
 	}
@@ -672,7 +672,6 @@
 
 	return sym;
 }
-#undef NAME
 
 static void
 bad_storage(Type *tp, char *name)