ref: f693fc0846b9cd1727a65994793c460bc0387e8f
parent: ea751374e538cbd3ed417f9e0bfc3b64d0b035b0
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Aug 27 12:18:01 EDT 2015
Add debug information and some TODO's
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -398,6 +398,8 @@
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 @@
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;
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -283,6 +283,7 @@
size = size + align & ~align;
size += tp->size;
}
+ /* TODO: Add aligment of the first field */
return size;
case UNION:
size = 0;
@@ -292,6 +293,7 @@
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 @@
type.p.pars = pars;
type.n.elem = nelem;
type.ns = 0;
+ /* TODO: Set aligment for new types */
switch (op) {
case ARY: