summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-02-26 21:37:40 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-02-26 21:37:40 -0500
commit82f19b0b7c3c709b6561e4229cc3c9713a999611 (patch)
treeac398abfcabbe0d17183aee5d9e19cfc5ed1911f
parent93337b93661a3298d2c915fc38bf9348bcd99207 (diff)
cleaned up a few TODOs
-rw-r--r--cgen.c15
-rw-r--r--eval.c4
-rw-r--r--foreign.c1
-rw-r--r--identifiers.c4
-rw-r--r--main.c1
-rw-r--r--parse.c1
-rw-r--r--tokenizer.c2
-rw-r--r--types.c1
8 files changed, 9 insertions, 20 deletions
diff --git a/cgen.c b/cgen.c
index baa24ba..81e13b6 100644
--- a/cgen.c
+++ b/cgen.c
@@ -1221,7 +1221,7 @@ static void cgen_expr_pre(CGenerator *g, Expression *e) {
static void cgen_expr(CGenerator *g, Expression *e) {
switch (e->kind) {
case EXPR_LITERAL_FLOAT:
- cgen_write(g, "%.16Lf", (long double)e->floatl); /* TODO(eventually): better precision? */
+ cgen_write(g, "%.16Lf", (long double)e->floatl);
break;
case EXPR_LITERAL_INT:
cgen_write(g, U64_FMT, e->intl);
@@ -1926,11 +1926,11 @@ static void cgen_ret(CGenerator *g, Expression *ret) {
}
static void cgen_stmt(CGenerator *g, Statement *s) {
- /*
- TODO(eventually): optionally this:
- cgen_write(g, "/\* %s:%d *\/", s->where.ctx->filename, s->where.line);
- (or even #line directives!)
- */
+
+#ifdef CGEN_EMIT_LINE_NUMBER_COMMENTS
+ /* TODO: add compiler option for this */
+ cgen_write(g, "/* %s:%d */", s->where.ctx->filename, s->where.line);
+#endif
switch (s->kind) {
case STMT_DECL:
cgen_decl(g, s->decl);
@@ -2032,9 +2032,6 @@ static void cgen_file(CGenerator *g, ParsedFile *f) {
g->fn = NULL;
g->file = f;
- /*
- TODO: don't include stdio.h with posix file descriptors
- */
cgen_write(g, "#include <stdint.h>\n"
"#include <stddef.h>\n"
"typedef int8_t i8;\n"
diff --git a/eval.c b/eval.c
index f732dd9..52bd874 100644
--- a/eval.c
+++ b/eval.c
@@ -532,7 +532,7 @@ static void eval_deref_set(void *set, Value *to, Type *type) {
assert(type->flags & TYPE_IS_RESOLVED);
switch (type->kind) {
case TYPE_PTR: *(void **)set = to->ptr; break;
- case TYPE_ARR: memcpy(set, to->arr, compiler_sizeof(type)); break; /* TODO: test this */
+ case TYPE_ARR: memcpy(set, to->arr, compiler_sizeof(type)); break;
case TYPE_STRUCT: memcpy(set, to->struc, compiler_sizeof(type)); break;
case TYPE_FN: *(FnExpr **)set = to->fn; break;
case TYPE_TUPLE: *(Value **)set = to->tuple; break;
@@ -1078,7 +1078,7 @@ static Status eval_expr(Evaluator *ev, Expression *e, Value *v) {
if (type_is_builtin(&o->type, BUILTIN_TYPE)) {
if (!eval_expr(ev, e->unary.of, &of)) return false;
/* "address" of type (pointer to type) */
- v->type = evalr_malloc(ev, sizeof *v->type); /* TODO: this might be bad in the future; should free this at some point */
+ v->type = evalr_malloc(ev, sizeof *v->type);
v->type->flags = 0;
v->type->kind = TYPE_PTR;
v->type->ptr = of.type;
diff --git a/foreign.c b/foreign.c
index ad14f7c..2a61aca 100644
--- a/foreign.c
+++ b/foreign.c
@@ -275,7 +275,6 @@ static bool foreign_call(ForeignFnManager *ffmgr, FnExpr *fn, Type *fn_type, Val
const char *libname = fn->foreign.lib;
Library *lib = str_hash_table_get(&ffmgr->libs_loaded, libname, strlen(libname));
if (!lib) {
- /* TODO: IMPORTANT: only open libraries once */
void *handle = dlopen(libname, RTLD_LAZY);
if (!handle) {
err_print(call_where, "Could not open dynamic library: %s.", libname);
diff --git a/identifiers.c b/identifiers.c
index cd4364e..abf8958 100644
--- a/identifiers.c
+++ b/identifiers.c
@@ -3,10 +3,6 @@
This file is part of toc. toc is distributed under version 3 of the GNU General Public License, without any warranty whatsoever.
You should have received a copy of the GNU General Public License along with toc. If not, see <https://www.gnu.org/licenses/>.
*/
-#if CHAR_MAX - CHAR_MIN > 255
-#error "Currently only systems with 8-bit characters can compile toc."
-/* TODO: not necessary anymore */
-#endif
/* can this character be used in an identifier? */
static int is_ident(int c) {
diff --git a/main.c b/main.c
index fc93cde..1a88831 100644
--- a/main.c
+++ b/main.c
@@ -141,7 +141,6 @@ int main(int argc, char **argv) {
typer_create(&tr, &ev, &err_ctx, &main_allocr, &globals);
if (!types_file(&tr, &f)) {
- /* TODO(eventually): fix this if the error occured while exporting something */
err_text_important(&err_ctx, "Errors occured while determining types.\n");
allocr_free_all(&main_allocr);
return EXIT_FAILURE;
diff --git a/parse.c b/parse.c
index 3e69d0a..b10f6c8 100644
--- a/parse.c
+++ b/parse.c
@@ -1144,7 +1144,6 @@ static Status parse_expr(Parser *p, Expression *e, Token *end) {
Token *start = t->token;
- /* TODO: consider moving this after ops, so that "if true { 5 } else { 3 } as f32" is possible */
if (t->token->kind == TOKEN_KW) switch (t->token->kw) {
case KW_FN: {
/* this is a function */
diff --git a/tokenizer.c b/tokenizer.c
index cd82c81..e31c2eb 100644
--- a/tokenizer.c
+++ b/tokenizer.c
@@ -142,7 +142,7 @@ static inline int char_as_hex_digit(char c) {
/* returns -1 if escape sequence is invalid */
static int tokr_esc_seq(Tokenizer *t) {
- /* TODO: add more of these incl. \x41, \100 */
+ /* TODO: octal (\032)? */
switch (*t->s) {
case '\'':
tokr_nextchar(t);
diff --git a/types.c b/types.c
index 231a319..472acf3 100644
--- a/types.c
+++ b/types.c
@@ -1389,7 +1389,6 @@ static Status types_expr(Typer *tr, Expression *e) {
*(Expression **)typer_arr_add(tr, &tr->in_exprs) = e;
typer_block_enter(tr, &fo->body); /* while this block is being typed, fo->body will be in tr->blocks twice. hopefully that doesn't mess anything up! */
if (fo->flags & FOR_IS_RANGE) {
- /* TODO: allow user-defined numerical types */
if (!types_expr(tr, fo->range.from)) goto for_fail;
{
Type *ft = &fo->range.from->type;