scc

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

commit 0cd87289743d229d3407647ca918daa980fe8725
parent 4faaf322b43040ad88b52e4917e753a64ea82b94
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 12 May 2015 11:02:19 +0200

Add comments

Diffstat:
cc1/decl.c | 6++++--
cc1/lex.c | 4++++
cc1/symbol.c | 1+
cc1/types.c | 1+
4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -153,6 +153,7 @@ declarator(Type *tp, int8_t flags, uint8_t ns) struct dcldata *bp; Symbol *sym; + /* TODO: Change this code. The memset is a very bad idea */ memset(data, 0, sizeof(data)); data[NR_DECLARATORS].op = 255; for (bp = declarator0(data, ns)-1; bp >= data; --bp) { @@ -511,8 +512,9 @@ extdecl(void) if (accept(';')) return; do { - setsafe(END_LDECL); - setjmp(recover); + /* FIX: we cannot put a setjmp here because + base was already assigned, and we were having + problems with EOF */ sym = declarator(base, ID_EXPECTED, NS_IDEN); tp = sym->type; sym->isstatic = 1; diff --git a/cc1/lex.c b/cc1/lex.c @@ -39,6 +39,9 @@ addinput(char *fname) FILE *fp; unsigned short nline = 1; + /* TODO: Add a field in input to see easier which is the case + where we are */ + if (fname) { if ((fp = fopen(fname, "r")) == NULL) return 0; @@ -543,6 +546,7 @@ ahead(void) { int c; + /* FIX: It will break all the error messages */ repeat: if (!fill()) return EOFTOK; diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -12,6 +12,7 @@ uint8_t curctx; static short localcnt; static short globalcnt; +/* TODO: unify all the hashes in only one hash */ static struct symtab { Symbol *head; Symbol *htab[NR_SYM_HASH]; diff --git a/cc1/types.c b/cc1/types.c @@ -234,6 +234,7 @@ mktype(Type *tp, uint8_t op, short nelem, void *data) tbl = &typetab[t]; for (bp = *tbl; bp; bp = bp->next) { if (eqtype(bp, &type)) { + /* FIXME: data can be a pointer to static data */ free(data); return bp; }