shithub: scc

Download patch

ref: 101edd9a3b5d71aecd5ed30c70b2ad011e27a66d
parent: cd9f71bbfc1f5bf8fc7a63931c29cce9acabda97
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Aug 26 18:22:05 EDT 2015

Emit pointer constants

Pointer constants have the same representation than TUINT values,
so they can share the code.

--- a/cc1/code.c
+++ b/cc1/code.c
@@ -181,10 +181,14 @@
 {
 	char *bp, c;
 	Symbol *sym = np->sym;
+	Type *tp = np->type;
+	TUINT u;
 
-	switch (BTYPE(np)) {
+	switch (tp->op) {
+	case PTR:
 	case INT:
-		printf("#%c%lX", np->type->letter, (long) sym->u.i);
+		u = (tp->sign) ? (TUINT) sym->u.i : sym->u.u;
+		printf("#%c%lX", np->type->letter, sym->u.i);
 		break;
 	case ARY:
 		/*