Aria

A low-level systems programming language
git clone git://git.m21c.me/Aria.git
Log | Files | Refs | README | LICENSE

commit fa6845ad461f8c45c162507160cd2121cdd6f335
parent b4df549b3d60fcbb55edcbc926e02b4d23be3447
Author: m21c <ho*******@gmail.com>
Date:   Wed, 17 Jun 2026 01:36:27 +0200

make sure compiler line length <= 80

Diffstat:
Mcompiler.c | 47++++++++++++++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/compiler.c b/compiler.c @@ -1157,7 +1157,9 @@ initkeywords(void) /* for (i = 0; i < lengthof(keywordkeys); ++i) { - printf("%-12s%c", keywordkeys[i] ? keywordkeys[i] : ".", (i+1) % 8 ? ' ' : '\n'); + printf("%-12s%c", + keywordkeys[i] ? keywordkeys[i] : ".", + (i+1) % 8 ? ' ' : '\n'); } */ } @@ -1293,7 +1295,9 @@ getstringkey(StringMap *map, const char *str, int n) map->valscap = cap; } - newstr = calloc(n + 1, sizeof(char*)); /* @todo sizeof(char*) --> sizeof(char) ? */ + /* @todo sizeof(char*) --> sizeof(char) ? */ + newstr = calloc(n + 1, sizeof(char*)); + assert(newstr); memcpy(newstr, str, n); @@ -1337,7 +1341,8 @@ warn(SrcLoc *loc, const char *fmt, ...) return n; } -#define error(loc, ...) error_(loc, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) +#define error(loc, ...) \ + error_(loc, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) static int error_(SrcLoc *loc, const char *func, const char *file, int line_, @@ -1354,7 +1359,8 @@ error_(SrcLoc *loc, const char *func, const char *file, int line_, n = fprintf(stderr, "%s:%u:%u: error: ", filename, line, column + 1); n += vfprintf(stderr, fmt, ap); - n += fprintf(stderr, " \x1b[30m[in %s() at %s:%u]\x1b[0m\n", func, file, line_); + n += fprintf(stderr, " \x1b[30m[in %s() at %s:%u]\x1b[0m\n", + func, file, line_); va_end(ap); ++errorcount; @@ -1986,7 +1992,8 @@ getunarysuffix(Source *source) Node *poolednodes; int poolednodecount, totalnodecount; -#define tokennode(source, lhs) makenode(&(source)->arenas, &(source)->tok, (lhs)) +#define tokennode(source, lhs) \ + makenode(&(source)->arenas, &(source)->tok, (lhs)) static Node * makenode(SourceArenas *arenas, Node *orig, Node *lhs) @@ -2483,7 +2490,8 @@ defertypedeclaration(Source *source, int key) /* FIXME(m21c): type may be overwritten, when the declaration * is completed */ - decl->type = maketype(&source->arenas, &source->tok.loc, primitive(TVOID), NULL); + decl->type = maketype( + &source->arenas, &source->tok.loc, primitive(TVOID), NULL); decl->type->module = decl; source->currenv = savedcurrenv; @@ -2877,7 +2885,9 @@ advance: (void) flags; if (getkind(source) == LSQRDELIM) { - Type *tmp = maketype(&source->arenas, getloc(source), primitive(TARRAY), basetype); + Type *tmp = maketype( + &source->arenas, getloc(source), + primitive(TARRAY), basetype); basetype = tmp; gettok(source); @@ -2889,7 +2899,9 @@ advance: } if (getkind(source) == OMUL) { - Type *tmp = maketype(&source->arenas, getloc(source), primitive(TPTR), basetype); + Type *tmp = maketype( + &source->arenas, getloc(source), + primitive(TPTR), basetype); basetype = tmp; gettok(source); @@ -3086,7 +3098,9 @@ redodeclaration: "cannot infer return type of function"); } - decl->type = maketype(&source->arenas, &decl->loc, primitive(TFUNCTION), paramtype); + decl->type = maketype( + &source->arenas, &decl->loc, + primitive(TFUNCTION), paramtype); decl->kind = DFUNCTION; decl->type->u.rtarget = ty; ty = decl->type; @@ -3318,7 +3332,9 @@ readrecord(Source *source, bool isunion) if (module->type->module == module) { *module->type = prim[TSTRUCT]; } else { - module->type = maketype(&source->arenas, &recordnode->loc, prim + typekind, NULL); + module->type = maketype( + &source->arenas, &recordnode->loc, + prim + typekind, NULL); } module->type->module = module; @@ -3574,7 +3590,9 @@ readatom(Source *source, int flags) case KNULL: lhs = tokennode(source, NULL); lhs->kind = NUMBER; - lhs->type = maketype(&source->arenas, &source->tok.loc, primitive(TPTR), primitive(TVOID)); + lhs->type = maketype( + &source->arenas, &source->tok.loc, + primitive(TPTR), primitive(TVOID)); lhs->u.u = (uintmax_t) (getkind(source) == KTRUE); gettok(source); break; @@ -4590,7 +4608,9 @@ forloop(Env *env, Node *expr, Node *header) /* @todo do proper typechecking */ header->rhs = wrap(env, header->lhs->type, typecheck(env, header->rhs)); - header->u.payload = wrap(env, header->lhs->type, typecheck(env, header->u.payload)); + header->u.payload = wrap( + env, header->lhs->type, + typecheck(env, header->u.payload)); return; } @@ -8117,7 +8137,8 @@ char bundlenamebuffer[1024 * 4]; int bundlenamelength = 0; static bool -processtopleveluse(Source *source, SrcLoc *loc, const int bundlepath[], int count) +processtopleveluse(Source *source, SrcLoc *loc, + const int bundlepath[], int count) { static const char prefix[] = "arialib/"; static const char suffix[] = ".co";