[hackers] [scc] Emit pointer constants || Roberto E. Vargas Caballero
commit 101edd9a3b5d71aecd5ed30c70b2ad011e27a66d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Aug 26 22:22:05 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Aug 26 22:22:05 2015 +0200
Emit pointer constants
Pointer constants have the same representation than TUINT values,
so they can share the code.
diff --git a/cc1/code.c b/cc1/code.c
index e8d79d4..fac9010 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -181,10 +181,14 @@ emitconst(Node *np)
{
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:
/*
Received on Wed Aug 26 2015 - 22:32:48 CEST
This archive was generated by hypermail 2.3.0
: Wed Aug 26 2015 - 22:36:20 CEST