diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 14:40:06 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-05-01 14:40:06 +0300 |
| commit | 7a68d1106b37e16c24e58bc77ce49fc6beadce9c (patch) | |
| tree | b0a3bb0b0124294b213cdfd3ae7b214bc32b19f5 | |
| parent | 48cd04e1a57f076287fb6ecdd0a4236e191ff7d3 (diff) | |
| download | fwd-7a68d1106b37e16c24e58bc77ce49fc6beadce9c.tar.gz fwd-7a68d1106b37e16c24e58bc77ce49fc6beadce9c.zip | |
run formatter
+ Should really get this done automatically somehow
| -rw-r--r-- | include/fwd/ast.h | 34 | ||||
| -rw-r--r-- | include/fwd/debug.h | 2 | ||||
| -rw-r--r-- | include/fwd/mod.h | 60 | ||||
| -rw-r--r-- | src/analyze.c | 176 | ||||
| -rw-r--r-- | src/compiler.c | 6 | ||||
| -rw-r--r-- | src/debug.c | 8 | ||||
| -rw-r--r-- | src/move.c | 22 | ||||
| -rw-r--r-- | src/rewrite.c | 4 | ||||
| -rw-r--r-- | src/scope.c | 8 | ||||
| -rw-r--r-- | uncrustify.conf | 2 |
10 files changed, 203 insertions, 119 deletions
diff --git a/include/fwd/ast.h b/include/fwd/ast.h index 4359525..8af444c 100644 --- a/include/fwd/ast.h +++ b/include/fwd/ast.h @@ -229,8 +229,8 @@ enum ast_flag { AST_FLAG_ANALYZED = (1 << 0), AST_FLAG_PREANALYZIS = (1 << 1), AST_FLAG_NOMOVES = (1 << 2), - AST_FLAG_PUBLIC = (1 << 3), - AST_REQ_FRAME = (1 << 4), + AST_FLAG_PUBLIC = (1 << 3), + AST_REQ_FRAME = (1 << 4), AST_FLAG_LOWERED = (1 << 5) }; @@ -387,15 +387,23 @@ static inline bool is_trivially_copyable(struct type *type) return false; } -#define gen_str_type1(k, s, t, a, loc) gen_ast(k, a, NULL, NULL, NULL, \ - t, s, -1, 0., loc) +#define gen_str_type1(k, s, t, a, loc) \ + gen_ast(k, a, NULL, NULL, NULL, \ + t, s, -1, 0., loc \ + ) + #define gen_str_type(k, s, t, loc) gen_str_type1(k, s, t, NULL, loc) -#define gen_str3(k, s, a, b, c, loc) gen_ast(k, a, b, c, NULL, NULL, s, -1, 0., \ - loc) +#define gen_str3(k, s, a, b, c, loc) \ + gen_ast(k, a, b, c, NULL, NULL, s, \ + -1, 0., loc \ + ) + #define gen_str2(k, s, a, b, loc) gen_str3(k, s, a, b, NULL, loc) #define gen_str1(k, s, a, loc) gen_str2(k, s, a, NULL, loc) -#define gen_str(k, s, loc) gen_ast(k, NULL, NULL, NULL, NULL, NULL, s, -1, 0., \ - loc) +#define gen_str(k, s, loc) \ + gen_ast(k, NULL, NULL, NULL, NULL, NULL, \ + s, -1, 0., loc \ + ) #define gen4(k, a, b, c, d, loc) gen_ast(k, a, b, c, d, NULL, NULL, -1, 0., loc) #define gen3(k, a, b, c, loc) gen4(k, a, b, c, NULL, loc) @@ -496,7 +504,9 @@ static inline bool is_trivially_copyable(struct type *type) gen_str3(AST_TEMPLATE, id, types, params, body, loc) #define gen_supertemplate(id, types, params, inst, body, loc) \ - gen_ast(AST_SUPERTEMPLATE, types, params, inst, body, NULL, id, 0, 0., loc) + gen_ast(AST_SUPERTEMPLATE, types, params, inst, body, \ + NULL, id, 0, 0., loc \ + ) #define gen_self(loc) \ gen0(AST_SELF, loc) @@ -668,8 +678,10 @@ struct ast *ast_prepend(struct ast *list, struct ast *elem); typedef int (*ast_callback_t)(struct ast *, void *); typedef int (*type_callback_t)(struct type *, void *); -int ast_visit(ast_callback_t before, ast_callback_t after, struct ast *node, - void *data); + +int ast_visit(ast_callback_t before, ast_callback_t after, + struct ast *node, void *data); + int ast_visit_list(ast_callback_t before, ast_callback_t after, struct ast *node, void *data); diff --git a/include/fwd/debug.h b/include/fwd/debug.h index ac4dfdf..8927580 100644 --- a/include/fwd/debug.h +++ b/include/fwd/debug.h @@ -97,7 +97,7 @@ void semantic_error(struct scope *scope, struct ast *node, const char *fmt, ...); void type_error(struct scope *scope, struct type *type, const char *fmt, - ...); + ...); void loc_error(struct scope *scope, struct src_loc loc, const char *fmt, ...); diff --git a/include/fwd/mod.h b/include/fwd/mod.h index ef0448e..1a48130 100644 --- a/include/fwd/mod.h +++ b/include/fwd/mod.h @@ -47,10 +47,14 @@ typedef struct fwd_state fwd_state_t; typedef long (*fwd_extern_t)(fwd_extern_args_t args); typedef long (*fwd_open_t)(fwd_state_t *state); -extern int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, fwd_type_t rtype, ...); +extern int fwd_register(struct fwd_state *state, const char *name, + fwd_extern_t func, fwd_type_t rtype, ...); -#define FWD_REGISTER(state, func, rtype, ...) \ - fwd_register(state, #func, func, rtype __VA_OPT__(,) __VA_ARGS__, FWD_END) +#define FWD_REGISTER(state, func, rtype, ...) \ + fwd_register(state, #func, func, \ + rtype __VA_OPT__( ,) __VA_ARGS__, \ + FWD_END \ + ) static inline void *fwd_arg(fwd_extern_args_t args, size_t idx, fwd_type_t id) { @@ -124,17 +128,18 @@ static inline fwd_arg_t fwd_ret_ptr(void *x) } /* unimplemented as of yet */ -#define FWD_RET(t, a, x) \ - (a).args[0] = _Generic((t)(0), \ - int8_t : fwd_ret_i8, \ - int16_t : fwd_ret_i16, \ - int32_t : fwd_ret_i32, \ - int64_t : fwd_ret_i64, \ - uint8_t : fwd_ret_u8, \ - uint16_t : fwd_ret_u16, \ - uint32_t : fwd_ret_u32, \ - uint64_t : fwd_ret_u64, \ - default : fwd_ret_ptr)((x)); +#define FWD_RET(t, a, x) \ + (a).args[0] = _Generic((t)(0), \ + int8_t: fwd_ret_i8, \ + int16_t: fwd_ret_i16, \ + int32_t: fwd_ret_i32, \ + int64_t: fwd_ret_i64, \ + uint8_t: fwd_ret_u8, \ + uint16_t: fwd_ret_u16, \ + uint32_t: fwd_ret_u32, \ + uint64_t: fwd_ret_u64, \ + default: fwd_ret_ptr \ + )((x)); static inline fwd_type_t fwd_t_signed(size_t s) { @@ -168,19 +173,20 @@ static inline fwd_type_t fwd_t_ptr(size_t s) return FWD_PTR; } -#define FWD_T(type) \ - _Generic((type)(0),\ - signed char : fwd_t_signed, \ - signed short : fwd_t_signed, \ - signed int : fwd_t_signed, \ - signed long : fwd_t_signed, \ - signed long long : fwd_t_signed, \ - unsigned char : fwd_t_unsigned, \ - unsigned short : fwd_t_unsigned, \ - unsigned int : fwd_t_unsigned, \ - unsigned long : fwd_t_unsigned, \ - unsigned long long : fwd_t_signed, \ - default: fwd_t_ptr)(sizeof(type)) +#define FWD_T(type) \ + _Generic((type)(0), \ + signed char : fwd_t_signed, \ + signed short : fwd_t_signed, \ + signed int : fwd_t_signed, \ + signed long : fwd_t_signed, \ + signed long long : fwd_t_signed, \ + unsigned char : fwd_t_unsigned, \ + unsigned short : fwd_t_unsigned, \ + unsigned int : fwd_t_unsigned, \ + unsigned long : fwd_t_unsigned, \ + unsigned long long : fwd_t_signed, \ + default: fwd_t_ptr \ + )(sizeof(type)) #endif /* FWD_MOD_H */ diff --git a/src/analyze.c b/src/analyze.c index fc94e15..fd1aabb 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -21,7 +21,8 @@ struct state { }; static int analyze(struct state *state, struct scope *scope, struct ast *node); -static int analyze_known_block(struct state *state, struct scope *scope, struct ast *node); +static int analyze_known_block(struct state *state, struct scope *scope, + struct ast *node); static int analyze_list(struct state *state, struct scope *scope, struct ast *nodes); @@ -157,7 +158,8 @@ static int analyze_comparison(struct state *state, struct scope *scope, return 0; } -static int analyze_known_block(struct state *state, struct scope *scope, struct ast *node) +static int analyze_known_block(struct state *state, struct scope *scope, + struct ast *node) { assert(node && node->k == AST_BLOCK); @@ -229,7 +231,8 @@ static int analyze_init(struct state *state, struct scope *scope, return -1; } -static int deduce_closure_types(struct scope *scope, struct ast *node, struct type *type) +static int deduce_closure_types(struct scope *scope, struct ast *node, + struct type *type) { /* a bit of checking duplication here, hmm */ if (node->k != AST_CLOSURE) @@ -242,13 +245,15 @@ static int deduce_closure_types(struct scope *scope, struct ast *node, struct ty struct ast *param = closure_bindings(node); struct type *t = (type->k == TYPE_CLOSURE) - ? tclosure_args(type) - : tpure_closure_args(type) - ; + ? tclosure_args(type) + : tpure_closure_args(type) + ; if (ast_list_len(param) != type_list_len(t)) { - semantic_error(scope, node, "expected %zu closure parameters, got %zu", - type_list_len(t), ast_list_len(param)); + semantic_error(scope, node, + "expected %zu closure parameters, got %zu", + type_list_len(t), ast_list_len(param) + ); return -1; } @@ -286,7 +291,8 @@ static int analyze_call(struct state *state, struct scope *scope, size_t got = ast_list_len(args); if (expected != got) { semantic_error(scope, node, "expected %d params, got %d", - expected, got); + expected, got + ); return -1; } @@ -351,15 +357,18 @@ static int analyze_deref(struct state *state, struct scope *scope, if (expr->t->k == TYPE_PTR) { semantic_error(node->scope, node, - "deref of raw ptr not allowed"); + "deref of raw ptr not allowed" + ); semantic_info(node->scope, node, - "use a nil check to convert to ref"); + "use a nil check to convert to ref" + ); return -1; } if (expr->t->k != TYPE_REF) { semantic_error(node->scope, node, - "deref of something not a reference"); + "deref of something not a reference" + ); return -1; } @@ -373,7 +382,8 @@ static int analyze_id(struct state *state, struct scope *scope, struct ast *found = file_scope_find_symbol(scope, id_str(node)); if (!found) { semantic_error(scope, node, "no symbol named \"%s\"", - id_str(node)); + id_str(node) + ); return -1; } @@ -468,7 +478,8 @@ static int analyze_str(struct state *state, struct scope *scope, return 0; } -static int analyze_template(struct state *state, struct scope *scope, struct ast *node) +static int analyze_template(struct state *state, struct scope *scope, + struct ast *node) { struct scope *template_scope = create_scope(); scope_add_scope(scope, template_scope); @@ -479,14 +490,17 @@ static int analyze_template(struct state *state, struct scope *scope, struct ast return 0; } -static int analyze_instance(struct state *state, struct scope *scope, struct ast *node) +static int analyze_instance(struct state *state, struct scope *scope, + struct ast *node) { (void)state; struct ast *id = instance_templ(node); struct ast *template = file_scope_find_template(scope, id_str(id)); if (!template) { - semantic_error(scope, node, "no such template: %s\n", id_str(id)); + semantic_error(scope, node, "no such template: %s\n", + id_str(id) + ); return -1; } @@ -495,7 +509,8 @@ static int analyze_instance(struct state *state, struct scope *scope, struct ast struct type *args = instance_type_args(node); if (ast_list_len(params) != type_list_len(args)) { semantic_error(scope, node, "expected %zu types, got %zu\n", - ast_list_len(params), type_list_len(args)); + ast_list_len(params), type_list_len(args) + ); return -1; } @@ -528,7 +543,8 @@ static int analyze_instance(struct state *state, struct scope *scope, struct ast return 0; } -static int analyze_struct(struct state *state, struct scope *scope, struct ast *node) +static int analyze_struct(struct state *state, struct scope *scope, + struct ast *node) { struct scope *struct_scope = create_scope(); scope_add_scope(scope, struct_scope); @@ -541,11 +557,14 @@ static int analyze_struct(struct state *state, struct scope *scope, struct ast * return 0; } -static int analyze_construct(struct state *state, struct scope *scope, struct ast *node) +static int analyze_construct(struct state *state, struct scope *scope, + struct ast *node) { struct ast *def = file_scope_find_type(scope, construct_id(node)); if (!def) { - semantic_error(scope, node, "no such type: %s", construct_id(node)); + semantic_error(scope, node, "no such type: %s", + construct_id(node) + ); return -1; } @@ -559,15 +578,20 @@ static int analyze_construct(struct state *state, struct scope *scope, struct as if (ast_list_len(params) != ast_list_len(args)) { semantic_error(scope, node, "expected %zu args, got %zu\n", - ast_list_len(params), ast_list_len(args)); + ast_list_len(params), ast_list_len(args) + ); return -1; } foreach_node(arg, args) { - struct ast *exists = scope_find_symbol(def->scope, construction_id(arg)); + struct ast *exists = scope_find_symbol(def->scope, + construction_id(arg) + ); if (!exists) { semantic_error(scope, arg, "no member %s in %s\n", - construction_id(arg), construct_id(node)); + construction_id(arg), + construct_id(node) + ); return -1; } @@ -588,7 +612,8 @@ static int analyze_construct(struct state *state, struct scope *scope, struct as return 0; } -static int analyze_explode(struct state *state, struct scope *scope, struct ast *node) +static int analyze_explode(struct state *state, struct scope *scope, + struct ast *node) { if (analyze(state, scope, explode_expr(node))) return -1; @@ -597,8 +622,9 @@ static int analyze_explode(struct state *state, struct scope *scope, struct ast if (type->k != TYPE_ID) { char *str = type_str(type); semantic_error(scope, explode_expr(node), - "expected struct type, got %s\n", - str); + "expected struct type, got %s\n", + str + ); free(str); return -1; } @@ -606,8 +632,9 @@ static int analyze_explode(struct state *state, struct scope *scope, struct ast struct ast *def = file_scope_find_type(scope, type->id); if (!def || def->k != AST_STRUCT_DEF) { semantic_error(scope, explode_expr(node), - "no such struct type: %s\n", - type->id); + "no such struct type: %s\n", + type->id + ); return -1; } @@ -616,16 +643,20 @@ static int analyze_explode(struct state *state, struct scope *scope, struct ast if (ast_list_len(params) != ast_list_len(args)) { semantic_error(scope, node, "expected %zu args, got %zu\n", - ast_list_len(params), ast_list_len(args)); + ast_list_len(params), ast_list_len(args) + ); return -1; } foreach_node(arg, args) { struct ast *var = deconstruction_var(arg); - struct ast *exists = scope_find_symbol(def->scope, deconstruction_id(arg)); + struct ast *exists = scope_find_symbol(def->scope, + deconstruction_id(arg) + ); if (!exists) { semantic_error(scope, arg, "no member %s in %s\n", - deconstruction_id(arg), type->id); + deconstruction_id(arg), type->id + ); return -1; } @@ -672,7 +703,8 @@ static int analyze_if(struct state *state, struct scope *scope, return 0; } -static int analyze_nil(struct state *state, struct scope *scope, struct ast *node) +static int analyze_nil(struct state *state, struct scope *scope, + struct ast *node) { (void)state; (void)scope; @@ -703,7 +735,8 @@ static bool castable_type(struct type *type) return false; } -static int analyze_as(struct state *state, struct scope *scope, struct ast *node) +static int analyze_as(struct state *state, struct scope *scope, + struct ast *node) { if (analyze(state, scope, as_expr(node))) return -1; @@ -734,7 +767,8 @@ static int analyze_as(struct state *state, struct scope *scope, struct ast *node return 0; } -static int analyze_sizeof(struct state *state, struct scope *scope, struct ast *node) +static int analyze_sizeof(struct state *state, struct scope *scope, + struct ast *node) { if (analyze_type(state, scope, sizeof_type(node))) return -1; @@ -744,7 +778,8 @@ static int analyze_sizeof(struct state *state, struct scope *scope, struct ast * return 0; } -static int analyze_nil_check(struct state *state, struct scope *scope, struct ast *node) +static int analyze_nil_check(struct state *state, struct scope *scope, + struct ast *node) { struct ast *expr = nil_check_expr(node); if (analyze(state, scope, expr)) @@ -781,7 +816,8 @@ static int analyze_nil_check(struct state *state, struct scope *scope, struct as return 0; } -static int analyze_forget(struct state *state, struct scope *scope, struct ast *node) +static int analyze_forget(struct state *state, struct scope *scope, + struct ast *node) { struct ast *def = file_scope_find_symbol(scope, forget_id(node)); if (!def) { @@ -793,7 +829,8 @@ static int analyze_forget(struct state *state, struct scope *scope, struct ast * return 0; } -static int analyze_put(struct state *state, struct scope *scope, struct ast *put) +static int analyze_put(struct state *state, struct scope *scope, + struct ast *put) { struct ast *dst = put_dst(put); if (analyze(state, scope, dst)) @@ -802,7 +839,9 @@ static int analyze_put(struct state *state, struct scope *scope, struct ast *put struct type *type = dst->t; if (type->k != TYPE_REF) { char *str = type_str(type); - semantic_error(scope, put, "trying to write to non-ref type %s\n", str); + semantic_error(scope, put, + "trying to write to non-ref type %s\n", str + ); free(str); return -1; } @@ -811,7 +850,8 @@ static int analyze_put(struct state *state, struct scope *scope, struct ast *put return 0; } -static int analyze_write(struct state *state, struct scope *scope, struct ast *write) +static int analyze_write(struct state *state, struct scope *scope, + struct ast *write) { struct ast *src = write_src(write); if (analyze(state, scope, src)) @@ -1125,14 +1165,15 @@ static struct type *fwd_type_kind(fwd_type_t type) case FWD_U64: return tgen_type(TYPE_U64, NULL, NULL, NULL_LOC()); case FWD_PTR: return tgen_nil(NULL_LOC()); default: - break; + break; } abort(); return NULL; } -int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, fwd_type_t rtype, ...) +int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, + fwd_type_t rtype, ...) { struct scope *scope = (void *)state; struct ast *vars = NULL; @@ -1153,7 +1194,9 @@ int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, f assert(name); sprintf(name, "%s%zu", "var", idx); - struct ast *new = gen_var(name, fwd_type_kind(type), NULL_LOC()); + struct ast *new = gen_var(name, fwd_type_kind(type), + NULL_LOC() + ); if (vars) new->n = vars; @@ -1167,8 +1210,12 @@ int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, f if (rtype != FWD_VOID) { char *name = strdup("ret"); struct ast *new = gen_var(name, - tgen_closure(fwd_type_kind(rtype), NULL_LOC()), - NULL_LOC()); + tgen_closure( + fwd_type_kind(rtype), + NULL_LOC() + ), + NULL_LOC() + ); if (vars) new->n = vars; @@ -1178,7 +1225,8 @@ int fwd_register(struct fwd_state *state, const char *name, fwd_extern_t func, f vars = reverse_ast_list(vars); struct ast *def = gen_proc(strdup(name), vars, - fwd_type_kind(rtype), NULL, NULL_LOC()); + fwd_type_kind(rtype), NULL, NULL_LOC() + ); if (scope_add_symbol(scope, def)) return -1; @@ -1191,23 +1239,23 @@ int analyze_root(struct scope *scope, struct ast *root) foreach_node(node, root) { switch (node->k) { case AST_PROC_DEF: - if (scope_add_symbol(scope, node)) - return -1; - break; + if (scope_add_symbol(scope, node)) + return -1; + break; case AST_STRUCT_DEF: - if (scope_add_type(scope, node)) - return -1; - break; + if (scope_add_type(scope, node)) + return -1; + break; case AST_STRUCT_CONT: - abort(); - break; + abort(); + break; case AST_TRAIT_DEF: - if (scope_add_trait(scope, node)) - return -1; - break; + if (scope_add_trait(scope, node)) + return -1; + break; case AST_IMPORT: { if (!try_import_mod(scope, node)) @@ -1220,20 +1268,20 @@ int analyze_root(struct scope *scope, struct ast *root) } case AST_TEMPLATE: - if (scope_add_template(scope, node)) - return -1; - break; + if (scope_add_template(scope, node)) + return -1; + break; case AST_SUPERTEMPLATE: - if (scope_add_template(scope, node)) - return -1; - break; + if (scope_add_template(scope, node)) + return -1; + break; case AST_INSTANCE: - break; + break; default: - abort(); + abort(); } } diff --git a/src/compiler.c b/src/compiler.c index 5de992d..f367f9a 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -151,7 +151,8 @@ struct scope *compile_file(const char *file) if (*dir != 0 && chdir(dir)) { error("couldn't change to directory %s: %s", dir, - strerror(errno)); + strerror(errno) + ); goto out; } @@ -176,7 +177,8 @@ struct scope *compile_file(const char *file) if (chdir(cwd)) { error("couldn't change back to directory %s: %s", cwd, - strerror(errno)); + strerror(errno) + ); goto out; } diff --git a/src/debug.c b/src/debug.c index 538fdfe..2426277 100644 --- a/src/debug.c +++ b/src/debug.c @@ -74,7 +74,8 @@ static void _issue(struct src_issue issue, const char *fmt, va_list args) { /* get start and end of current line in buffer */ const char *line_start = find_lineno(issue.fctx.fbuf, - (size_t)issue.loc.first_line); + (size_t)issue.loc.first_line + ); const char *line_end = strchr(line_start, '\n'); if (!line_end) line_end = strchr(line_start, 0); @@ -84,7 +85,8 @@ static void _issue(struct src_issue issue, const char *fmt, va_list args) fprintf(stderr, "%s:%i:%i: %s: ", issue.fctx.fname, issue.loc.first_line, issue.loc.first_col, - issue_level_str(issue.level)); + issue_level_str(issue.level) + ); vfprintf(stderr, fmt, args); fputc('\n', stderr); @@ -135,7 +137,7 @@ void semantic_error(struct scope *scope, struct ast *node, } void type_error(struct scope *scope, struct type *type, - const char *fmt, ...) + const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -140,7 +140,8 @@ static void forget_references(struct state *state) static int mvcheck_expr(struct state *state, struct ast *node); static int mvcheck_expr_list(struct state *state, struct ast *nodes); -static int mvcheck_statements(struct state *state, struct ast *nodes, bool last); +static int mvcheck_statements(struct state *state, struct ast *nodes, + bool last); static int refcheck_id(struct state *state, struct ast *node) { @@ -176,7 +177,8 @@ static int refcheck(struct state *state, struct ast *node) case AST_ID: return refcheck_id(state, node); default: internal_error("unhandled node %s for refcheck", - ast_str(node->k)); + ast_str(node->k) + ); return -1; } @@ -213,7 +215,9 @@ static int total_check_single(struct state *state, struct scope *scope) if (prev) continue; - semantic_warn(scope, def, "%s not moved, might leak", var_id(def)); + semantic_warn(scope, def, "%s not moved, might leak", + var_id(def) + ); ret |= 1; } @@ -304,7 +308,8 @@ static int mvcheck_call(struct state *state, struct ast *node, bool last) if (!last && (groups > 0)) { semantic_error(node->scope, node, - "calls with closures must currently be exit points, sorry!"); + "calls with closures must currently be exit points, sorry!" + ); return -1; } @@ -390,7 +395,8 @@ static int mvcheck_id(struct state *state, struct ast *node) if (in_pure(state)) { semantic_error(node->scope, node, - "move in pure context not allowed"); + "move in pure context not allowed" + ); return -1; } @@ -432,7 +438,8 @@ static int mvcheck_if(struct state *state, struct ast *node, bool last) { if (!last) { semantic_error(node->scope, node, - "`if` statements must currently be exit points, sorry!"); + "`if` statements must currently be exit points, sorry!" + ); return -1; } @@ -518,7 +525,8 @@ static int mvcheck_nil_check(struct state *state, struct ast *node, bool last) if (!last) { /** @todo would this be an internal error? */ semantic_error(node->scope, node, - "`nil check` must be exit point, sorry"); + "`nil check` must be exit point, sorry" + ); return -1; } diff --git a/src/rewrite.c b/src/rewrite.c index e3cea01..c5a497a 100644 --- a/src/rewrite.c +++ b/src/rewrite.c @@ -36,7 +36,9 @@ static int rewrite_type_visit(struct ast *node, struct type_helper *helper) int rewrite_types(struct ast *node, char *orig, char *new) { struct type_helper helper = {.orig = orig, .new = new}; - return ast_visit((ast_callback_t)rewrite_type_visit, NULL, node, &helper); + return ast_visit((ast_callback_t)rewrite_type_visit, NULL, node, + &helper + ); } /* not the fastest thing in the world but should work well enough for now */ diff --git a/src/scope.c b/src/scope.c index e49b828..251edef 100644 --- a/src/scope.c +++ b/src/scope.c @@ -71,7 +71,9 @@ void destroy_scope(struct scope *scope) int scope_add_symbol(struct scope *scope, struct ast *symbol) { assert(symbol->k == AST_VAR_DEF || symbol->k == AST_PROC_DEF); - struct ast **exists = visible_insert(&scope->symbols, symbol->s, symbol); + struct ast **exists = visible_insert(&scope->symbols, symbol->s, + symbol + ); if (!exists) { internal_error("failed inserting symbol into scope"); return -1; @@ -187,7 +189,9 @@ struct ast *file_scope_find_trait(struct scope *scope, char *id) int scope_add_template(struct scope *scope, struct ast *template) { - struct ast **exists = visible_insert(&scope->templates, template->s, template); + struct ast **exists = visible_insert(&scope->templates, template->s, + template + ); if (!exists) { internal_error("failed inserting template into scope"); return -1; diff --git a/uncrustify.conf b/uncrustify.conf index 5e01d98..d262c40 100644 --- a/uncrustify.conf +++ b/uncrustify.conf @@ -1448,7 +1448,7 @@ indent_paren_nl = false # true/false # 1: Align under the open parenthesis # 2: Indent to the brace level # -1: Preserve original indentation -indent_paren_close = 0 # number +indent_paren_close = 2 # number # Whether to indent the open parenthesis of a function definition, # if the parenthesis is on its own line. |
