commit 6de645708aeccb05b24493ff85bc4a429152d5ec
parent 6919d066b3c2385a73fecf39cb11ac83cdbd97bb
Author: m21c <ho*******@gmail.com>
Date: Fri, 12 Jun 2026 09:16:33 +0200
change src note/todo comments to @-notation
Diffstat:
| M | compiler.c | | | 134 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
1 file changed, 67 insertions(+), 67 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -286,7 +286,7 @@ struct Block Block;
#define TSSIZE TS64
#define TUSIZE TU64
-/* TODO(m21c): maybe add long double type ? */
+/* @todo maybe add long double type ? */
#define TYPEKEWORDYTAB \
entry(VOID) entry(BOOL) \
@@ -370,7 +370,7 @@ enum TypeKind {
typedef
enum DeclKind {
DMODULE = 0,
- DTYPE, /* NOTE(m21c): maybe be the same as void-module ? */
+ DTYPE, /* @note maybe be the same as void-module ? */
DVAR,
DPARAM,
DFUNCTION,
@@ -724,10 +724,10 @@ struct Edge {
EdgeKind kind;
Section *section;
- Conduct *gistlist; /* NOTE(m21c): maybe remove this, since the gistlist
+ Conduct *gistlist; /* @note maybe remove this, since the gistlist
* is always the last of a section */
- /* TODO(m21c): add information about the branch/edge condition */
+ /* @todo add information about the branch/edge condition */
/* for memory-management, since an edge is used in mult. edge-entries */
int refcount;
@@ -740,7 +740,7 @@ typedef enum EdgeEntryKind {
JEND = 3 /* added as branchto edge entry to last section */
} EdgeEntryKind;
-/* NOTE(m21c): since an edge is used in multiple lists, edge-entry is used
+/* @note since an edge is used in multiple lists, edge-entry is used
* as linked-list entry */
struct EdgeEntry {
EdgeEntryKind kind;
@@ -1206,7 +1206,7 @@ getstringkey(StringMap *map, const char *str, int n)
map->valscap = cap;
}
- newstr = calloc(n + 1, sizeof(char*)); /* TODO(m21c): sizeof(char*) --> sizeof(char) ? */
+ newstr = calloc(n + 1, sizeof(char*)); /* @todo sizeof(char*) --> sizeof(char) ? */
assert(newstr);
memcpy(newstr, str, n);
@@ -1554,7 +1554,7 @@ tokenizestring(Source *source, register int ch)
ch = '"';
break;
- /* TODO(m21c): read more escape sequences */
+ /* @todo read more escape sequences */
case 0:
goto stringeol;
@@ -1874,7 +1874,7 @@ getunarysuffix(Source *source)
if (getprec(kind) == PUNSUF)
return kind;
- /* NOTE(m21c): fixes parsing unary suffix across multiple lines.
+ /* @note fixes parsing unary suffix across multiple lines.
* (which shouldn't happen) */
if (isbasicdelimiter(source->lastkind))
return 0;
@@ -2018,7 +2018,7 @@ makeannot(SrcLoc *loc, int key)
annot->key = key;
annot->loc = *loc;
- /* TODO(m21c): implement initialization. */
+ /* @todo implement initialization. */
return annot;
}
@@ -2034,7 +2034,7 @@ makedocket(Node *node)
docket = docketbuf + dockettop;
- /* TODO(m21c): implement initialization. */
+ /* @todo implement initialization. */
return docket;
}
@@ -2077,7 +2077,7 @@ finddeclaration(Source *source, Env *startenv, int key)
Decl *decl;
for (env = startenv; env; env = env->below) {
- /* NOTE(m21c): look-up exclusion list first.
+ /* @note look-up exclusion list first.
* If found: only lookup in found env */
/* FIXME(m21c): make a separate list, and not use excludehead,
* excludenext ! */
@@ -2118,15 +2118,15 @@ finddeclaration(Source *source, Env *startenv, int key)
static Env *
setheadenv(Source *source, EnvKind kind)
{
- /* NOTE(m21c): this might only be useful for parameter => function env
+ /* @note this might only be useful for parameter => function env
* translation */
Env *env = envbuf + envtop++;
env->kind = kind;
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
env->loc = source->tok.loc;
@@ -2155,9 +2155,9 @@ pushenv(Source *source, EnvKind kind)
env = envbuf + envtop++;
env->kind = kind;
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
env->loc = source->tok.loc;
@@ -2210,7 +2210,7 @@ deferfuncenv(Source *source, int keydeclinfunc)
pendingprev, pendingnext);
}
} else {
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
error(
@@ -2243,7 +2243,7 @@ deleteenv(Env *env)
if (env->stmts)
deletenode(env->stmts);
- /* TODO(m21c): delete env */
+ /* @todo delete env */
}
@@ -2296,7 +2296,7 @@ makedecl(Source *source, int key, DeclKind kind)
assert(currenv);
- /* TODO(m21c): maybe remove check if already declared,
+ /* @todo maybe remove check if already declared,
* since many functions that call makedecl
* already try to obtain a declaration for
* other reasons. So the check if it is
@@ -2313,9 +2313,9 @@ makedecl(Source *source, int key, DeclKind kind)
return decl;
}
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
error(
@@ -2328,9 +2328,9 @@ makedecl(Source *source, int key, DeclKind kind)
decl = declbuf + decltop++;
decl->kind = kind;
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
decl->loc = source->tok.loc;
@@ -2355,9 +2355,9 @@ makebundle(Source *source, int key, Decl *parentbundle)
decl = declbuf + decltop++;
decl->kind = DBUNDLE;
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
decl->loc = source->tok.loc;
@@ -2376,7 +2376,7 @@ makedecl2(SrcLoc *loc, Env *env, int key, DeclKind kind)
assert(env);
- /* TODO(m21c): maybe remove check if already declared,
+ /* @todo maybe remove check if already declared,
* since many functions that call makedecl
* already try to obtain a declaration for
* other reasons. So the check if it is
@@ -2392,9 +2392,9 @@ makedecl2(SrcLoc *loc, Env *env, int key, DeclKind kind)
decl = declbuf + decltop++;
decl->kind = kind;
- /* TODO(m21c): make sure that source->tok.loc is the correct
+ /* @todo make sure that source->tok.loc is the correct
* source-location. */
- /* TODO(m21c): maybe use getloc(source) instead of
+ /* @todo maybe use getloc(source) instead of
* &source->tok.loc and move the declaration of
* getloc() up in the source-code. */
decl->loc = *loc;
@@ -2610,7 +2610,7 @@ readannots(Source *source)
if (docket == NULL) {
docket = makedocket(NULL);
- /* TODO(m21c): add docket to source */
+ /* @todo add docket to source */
}
listappend(docket, annot);
@@ -2646,7 +2646,7 @@ checkend(Source *source, bool hastail, int needindent,
}
if (source->lastkind == LINEDELIM && source->lastindent < needindent) {
- /* NOTE(m21c): Is that correct? Maybe we should always pushback
+ /* @note Is that correct? Maybe we should always pushback
* a made-up new-line, instead of asserting that we
* have saved one. Since it might be the case, that
* we already have read a new-line prior the call
@@ -2663,13 +2663,13 @@ checkend(Source *source, bool hastail, int needindent,
savedtok = source->tok;
gettok(source);
- /* NOTE(m21c): used for REPL. it allows having
+ /* @note used for REPL. it allows having
* semicolons on line-endings and nultiple
* adjacent semecolons in REPL-mode. */
if ((getkind(source) == SEMIDELIM ||
getkind(source) == LINEDELIM) &&
source->filein != stdin)
- /* NOTE(m21c): output an error-message if not in REPL-mode */
+ /* @note output an error-message if not in REPL-mode */
error(&savedtok.loc, "trailing semicolon.");
}
@@ -2774,7 +2774,7 @@ qualifiers(Source *source, int allowmask)
f = QCONST, m = 0;
break;
- /* TODO(m21c): remove this */
+ /* @todo remove this */
case KVAR:
f = QVAR, m = ~(QTYPE | QINFER);
break;
@@ -2872,7 +2872,7 @@ declaration(Source *source, Type *ty, bool tryreadtype)
if (!ty)
return NULL;
- /* TODO(m21c): use the currenv->kind as context, whether or how
+ /* @todo use the currenv->kind as context, whether or how
* certain declarations (like function-declarations)
* are processed */
@@ -2940,7 +2940,7 @@ redodeclaration:
error(getloc(source), "expected '.' or ':'");
}
- /* TODO(m21c): obtain Decl* for
+ /* @todo obtain Decl* for
* Type Module:my_decl
* or Type Module.my_decl - declarations */
@@ -3065,10 +3065,10 @@ redodeclaration:
decl->u.content = body;
- /* TODO(m21c): maybe add function-declaration to its type and
+ /* @todo maybe add function-declaration to its type and
* add the paramlist to the type-info */
- /* TODO(m21c): store the params-node (its initializations)
+ /* @todo store the params-node (its initializations)
* somewhere */
goto finish;
@@ -3152,7 +3152,7 @@ readident(Source *source, int flags)
}
if (flags & QCONST) {
- /* TODO(m21c): const - conversion */
+ /* @todo const - conversion */
}
return lhs;
@@ -3274,11 +3274,11 @@ readrecord(Source *source, bool isunion)
/* read record body */
- /* NOTE(m21c): maybe we will use stmtlist() for parsing the record body,
+ /* @note maybe we will use stmtlist() for parsing the record body,
since we have to parse statements or expressions beside
field declarations */
- /* TODO(m21c): check for new-line and only then read body */
+ /* @todo check for new-line and only then read body */
recordnode->rhs = stmtlist(source, indent, envkind, module, false);
if (recordnode->rhs) {
module->contentenv = recordnode->rhs->u.env;
@@ -3286,7 +3286,7 @@ readrecord(Source *source, bool isunion)
record = makerecord(module);
- /* TODO(m21c): validate record body, extract declarations,
+ /* @todo validate record body, extract declarations,
* compute size and align, resolve aliases */
if (recordnode->rhs) {
@@ -3409,7 +3409,7 @@ readatom(Source *source, int flags)
if (getunary(source->tok.kind)) {
lhs = tokennode(source, NULL);
- /* TODO(m21c): remove redundant function-call */
+ /* @todo remove redundant function-call */
lhs->kind = getunary(source->tok.kind);
gettok(source);
@@ -3443,7 +3443,7 @@ readatom(Source *source, int flags)
source->lastis = savedis;
if (lhs->kind == TYPE) {
- /* NOTE(m21c): expecting that the type is also set in lhs->type */
+ /* @note expecting that the type is also set in lhs->type */
lhs->kind = OCAST;
skipnewline(source);
expect(source, RPARDELIM, "expected ')'");
@@ -3496,7 +3496,7 @@ readatom(Source *source, int flags)
gettok(source);
if (flags & QCONST) {
- /* TODO(m21c): const - conversion */
+ /* @todo const - conversion */
}
break;
@@ -3741,7 +3741,7 @@ readatom(Source *source, int flags)
while (getunarysuffix(source)) {
lhs = tokennode(source, lhs);
- /* TODO(m21c): remove redundant function-call */
+ /* @todo remove redundant function-call */
lhs->kind = getunarysuffix(source);
if (getkind(source) == ODISP) {
@@ -3899,7 +3899,7 @@ todeclaration(Node *curr, Node **ty)
}
#endif
-/* TODO(m21c): this is stupid! There should be a simpler way to parse the
+/* @todo this is stupid! There should be a simpler way to parse the
* comma-expressions (comma-operator, param-list, declaration-list,
* type-tuples and expression-tuples) */
static Node *
@@ -4126,7 +4126,7 @@ islvalue(Node *node)
}
}
-/* TODO(m21c): also mask int/float values in the tokenizer */
+/* @todo also mask int/float values in the tokenizer */
static uintmax_t
maskint(int size, uintmax_t value)
{
@@ -4173,12 +4173,12 @@ wrap(Type *type, Node *node)
assert(nodetype);
- /* TODO(m21c): do proper type-check */
+ /* @todo do proper type-check */
if (type->kind == nodetype->kind)
return node;
if (node->kind == NUMBER) {
- /* TODO(m21c): layout correct type-conversions ? */
+ /* @todo layout correct type-conversions ? */
if (isfloattype(nodetype)) {
if (isfloattype(type)) {
node->u.d = maskfloat(
@@ -4218,11 +4218,11 @@ wrap(Type *type, Node *node)
return node;
}
- /* NOTE(m21c): no implicit (de-)referencing if the wrap-type is bool */
+ /* @note no implicit (de-)referencing if the wrap-type is bool */
if (type->kind == TBOOL)
goto doconversion;
- /* TODO(m21c): skip implicit (de-)referencing on arithmetic
+ /* @todo skip implicit (de-)referencing on arithmetic
* conversion, also skip if called from conv() */
/* implicit referencing: */
@@ -4231,7 +4231,7 @@ wrap(Type *type, Node *node)
node->kind = OADDR;
node->type = type->target;
- /* TODO(m21c): check for lvalue & maybe do further
+ /* @todo check for lvalue & maybe do further
* type-checks*/
return node;
}
@@ -4242,7 +4242,7 @@ wrap(Type *type, Node *node)
node->kind = ODEREF;
node->type = type;
- /* TODO(m21c): maybe do further type-checks*/
+ /* @todo maybe do further type-checks*/
return node;
}
@@ -4306,8 +4306,8 @@ arithtuplereorder(Env *env, Node *expr, int numops)
tmp = expr->rhs;
expr->rhs = makenode(expr, expr->lhs->rhs);
- expr->lhs->rhs = tmp; /* NOTE(m21c): some unary nodes may have a rhs? */
- expr->rhs->rhs = tmp; /* TODO(m21c): make a copy */
+ expr->lhs->rhs = tmp; /* @note some unary nodes may have a rhs? */
+ expr->rhs->rhs = tmp; /* @todo make a copy */
expr->kind = ACOMMA;
return true;
@@ -4831,7 +4831,7 @@ typecheck(Env *env, Node *expr)
if (rhs)
expr->rhs = typecheck(env, rhs);
- /* TODO(m21c): find a way how we do type-checking for the
+ /* @todo find a way how we do type-checking for the
* last expression in a statement-list, which
* might be needed by the enclosed statement-list
*/
@@ -4917,7 +4917,7 @@ typecheck(Env *env, Node *expr)
assert(lhs);
assert(rhs);
- /* TODO(m21c): make sure that typechecking is done
+ /* @todo make sure that typechecking is done
* correctly, since comma might be re-
* ordered:
* - check that maketype is NOT called
@@ -4931,7 +4931,7 @@ typecheck(Env *env, Node *expr)
lhs = typecheck(env, lhs);
rhs = typecheck(env, rhs);
- /* NOTE(m21c): converting nodes may be uneccessary */
+ /* @note converting nodes may be uneccessary */
expr->lhs = conv(lhs);
expr->rhs = conv(rhs);
@@ -5064,7 +5064,7 @@ foldexpr(Env *env, Node *expr)
((expr->u.u == value && isintorbooltype(ty)) || \
(expr->u.d == value && isarithtype(ty))))
- /* TODO(m21c): maybe modify getnumops() in such a way, that it
+ /* @todo maybe modify getnumops() in such a way, that it
* will behave properly for non-operator nodes too */
switch (getnumops(expr->kind)) {
case 2:
@@ -5109,7 +5109,7 @@ foldexpr(Env *env, Node *expr)
} else if (expr->kind == ODIV) {
evalbinary(/);
} else {
- evalbinary(/); /* TODO(m21c): implement modulus for float-types */
+ evalbinary(/); /* @todo implement modulus for float-types */
}
}
} else if (isvalue(lhs, 0)) {
@@ -5220,7 +5220,7 @@ foldexpr(Env *env, Node *expr)
} else /* if (expr->kind == KLENGTHOF) */ {
- /* TODO(m21c): add case for slice */
+ /* @todo add case for slice */
if (lhs->type->kind == TARRAY)
expr->u.u = lhs->type->u.array.length;
else if (lhs->type->kind == TPTR) {
@@ -5237,7 +5237,7 @@ foldexpr(Env *env, Node *expr)
return expr;
case ACONV:
- /* TODO(m21c): implement this properly! */
+ /* @todo implement this properly! */
lhs = foldexpr(env, lhs);
if (lhs->type->kind == expr->type->kind)
*expr = *lhs, deletenode(lhs);
@@ -5395,7 +5395,7 @@ gistread(Conduct *conduct, Node *node)
decl = node->u.declref;
- /* NOTE(m21c): additional checks require that this moves
+ /* @note additional checks require that this moves
* somewhere else. */
if ( decl->kind == DPARAM ||
(decl->kind == DVAR &&
@@ -5414,7 +5414,7 @@ gistread(Conduct *conduct, Node *node)
assert(where);
error(&node->loc, "use of un-initialized '%s'.", name);
- /* TODO(m21c): change to notice or similiar,
+ /* @todo change to notice or similiar,
* instead of warn */
warn(&where->loc, "last use of '%s' was here.", name);
} else {
@@ -6044,7 +6044,7 @@ cgtypetail(CodeGen *cg, Type *type)
case TARRAY:
cgprintf(cg, "[");
- /* NOTE(m21c): the value may be always set in the future */
+ /* @note the value may be always set in the future */
if (type->u.val)
codegen(cg, type->u.val);
@@ -7101,7 +7101,7 @@ printtypetail(FILE *out, Type *type, int indent)
case TARRAY:
n += fprintf(out, "[");
- /* NOTE(m21c): the value may be always set in the future */
+ /* @note the value may be always set in the future */
if (type->u.val)
n += printexpr(out, type->u.val, indent);
@@ -7761,7 +7761,7 @@ printexpr(FILE *out, Node *expr, int indent)
break;
case ASCOPE:
- /* TODO(m21c): improve this piece of code */
+ /* @todo improve this piece of code */
if (expr->lhs &&
expr->lhs->kind == ASTMT &&
expr->u.env &&