commit f693fc0846b9cd1727a65994793c460bc0387e8f
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Aug 27 16:18:01 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Thu Aug 27 16:18:01 2015 +0200

    Add debug information and some TODO's

diff --git a/cc1/decl.c b/cc1/decl.c
index 62ea6f1..c92d546 100644
--- 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
index 2bf3a84..ee1dad0 100644
--- 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:

Reply via email to