scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit f693fc0846b9cd1727a65994793c460bc0387e8f
parent ea751374e538cbd3ed417f9e0bfc3b64d0b035b0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 27 Aug 2015 16:18:01 +0200

Add debug information and some TODO's

Diffstat:
cc1/decl.c | 3+++
cc1/types.c | 3+++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -398,6 +398,8 @@ newtag(void) tp->p.fields = NULL; sym->type = tp; tp->tag = sym; + DBG(stderr, "declared tag '%s' with ns = %d\n", + (sym->name) ? sym->name : "anonymous", tp->ns); } if ((op = sym->type->op) != tag && op != INT) @@ -535,6 +537,7 @@ field(struct decl *dcl) sym->flags |= ISFIELD; if (n == NR_FIELDS) error("too much fields in struct/union"); + DBG(stderr, "New field '%s' in namespace %d\n", name, structp->ns); structp->p.fields = xrealloc(structp->p.fields, ++n * sizeof(*sym)); structp->p.fields[n-1] = sym; structp->n.elem = n; diff --git a/cc1/types.c b/cc1/types.c @@ -283,6 +283,7 @@ typesize(Type *tp) size = size + align & ~align; size += tp->size; } + /* TODO: Add aligment of the first field */ return size; case UNION: size = 0; @@ -292,6 +293,7 @@ typesize(Type *tp) if (tp->size > size) size = tp->size; } + /* TODO: Add aligment of the worst field */ return size; case ENUM: return inttype->size; @@ -325,6 +327,7 @@ mktype(Type *tp, unsigned op, short nelem, Type *pars[]) type.p.pars = pars; type.n.elem = nelem; type.ns = 0; + /* TODO: Set aligment for new types */ switch (op) { case ARY: