harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit 9637edc01818684a0df679beccb658375c893495
parent 38c2198973ec0c2f56b9108a4ab0029a6671fdd9
Author: Sebastian <sebastian@sebsite.pw>
Date:   Fri,  6 May 2022 22:46:48 -0400

all: style

Removes trailing whitespace, missing or unneeded spaces, etc.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Msrc/eval.c | 2+-
Msrc/gen.c | 2+-
Msrc/lex.c | 2+-
Msrc/parse.c | 2+-
Msrc/typedef.c | 2+-
Msrc/types.c | 4++--
Mtests/08-slices.ha | 2+-
Mtests/18-match.ha | 4++--
Mtests/20-if.ha | 4++--
Mtests/21-tuples.ha | 2+-
Mtests/26-gen.ha | 10+++++-----
11 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/eval.c b/src/eval.c @@ -394,7 +394,7 @@ eval_cast(struct context *ctx, struct expression *in, struct expression *out) } const struct type *to = type_dealias(in->result), - *from = type_dealias(val.result); + *from = type_dealias(val.result); // The STORAGE_ARRAY exception is to make sure we handle expandable // arrays at this point. if (to->storage == from->storage && to->storage != STORAGE_ARRAY) { diff --git a/src/gen.c b/src/gen.c @@ -1159,7 +1159,7 @@ gen_expr_cast_slice_at(struct gen_context *ctx, const struct expression *expr, struct gen_value out) { const struct type *to = expr->result, - *from = type_dealias(expr->cast.value->result); + *from = type_dealias(expr->cast.value->result); if (from->storage == STORAGE_POINTER) { from = type_dealias(from->pointer.referent); } diff --git a/src/lex.c b/src/lex.c @@ -383,7 +383,7 @@ finalize: [STORAGE_I16] = "i16", [STORAGE_I32] = "i32", [STORAGE_I64] = "i64", - + [STORAGE_UINT] = "u", [STORAGE_INT] = "i", [STORAGE_SIZE] = "z", diff --git a/src/parse.c b/src/parse.c @@ -1864,7 +1864,7 @@ parse_switch_expression(struct lexer *lexer) want(lexer, T_LBRACE, &tok); bool more = true; - struct ast_switch_case **next_case = &exp->_switch.cases; + struct ast_switch_case **next_case = &exp->_switch.cases; while (more) { struct ast_switch_case *_case = *next_case = xcalloc(1, sizeof(struct ast_switch_case)); diff --git a/src/typedef.c b/src/typedef.c @@ -181,7 +181,7 @@ emit_struct(const struct type *type, FILE *out) fprintf(out, "%s { ", type->storage == STORAGE_STRUCT ? "struct" : "union"); for (size_t i = 0; i < n; ++i) { - const struct struct_field *f = fields[i]; + const struct struct_field *f = fields[i]; if (!type->struct_union.c_compat) { fprintf(out, "@offset(%zd) ", f->offset); } diff --git a/src/types.c b/src/types.c @@ -687,7 +687,7 @@ tagged_subset_compat(const struct type *superset, const struct type *subset) return false; } const struct type_tagged_union *superset_tu = &superset->tagged, - *subset_tu = &subset->tagged; + *subset_tu = &subset->tagged; while (subset_tu && superset_tu) { while (superset_tu) { if (superset_tu->type->id == subset_tu->type->id) { @@ -732,7 +732,7 @@ type_is_assignable(const struct type *to, const struct type *from) if (to->id == from->id && to->storage != STORAGE_VOID) { return true; } - + if (type_is_constant(from)) { return promote_const(to_orig, from_orig); } diff --git a/tests/08-slices.ha b/tests/08-slices.ha @@ -123,7 +123,7 @@ fn slicing() void = { assert_slice_eq(p[1..3], [2, 3]); assert_slice_eq(p[1..], [2, 3, 4, 5]); assert_slice_eq(p[5..], []); - + assert(rt::compile( "fn test() void = { let x = \"test\"; x[1..3]; };" ) != 0, "slicing non-array, non-slice object"); diff --git a/tests/18-match.ha b/tests/18-match.ha @@ -62,9 +62,9 @@ fn pointer() void = { abort(); }; assert(z == 42); - + y = null; - z = match(y) { + z = match (y) { case *int => abort(); case null => diff --git a/tests/20-if.ha b/tests/20-if.ha @@ -54,8 +54,8 @@ fn or() void = { }; fn tagged() void = { - assert((if (true) 1u8 else 0i8) as u8 == 1); - assert((if (false) 1u8 else 0i8) as i8 == 0); + assert((if (true) 1u8 else 0i8) as u8 == 1); + assert((if (false) 1u8 else 0i8) as i8 == 0); }; type abool = bool; diff --git a/tests/21-tuples.ha b/tests/21-tuples.ha @@ -18,7 +18,7 @@ fn indexing() void = { fn func(in: (int, size)) (int, size) = (in.0 + 1, in.1 + 1); fn eval_expr_access() void = { - static assert ((42, 0).0 == 42 && (42, 0).1 == 0); + static assert((42, 0).0 == 42 && (42, 0).1 == 0); }; fn eval_expr_tuple() void = { diff --git a/tests/26-gen.ha b/tests/26-gen.ha @@ -53,13 +53,13 @@ export fn main() void = { }; assert(*p == 0); - let thing: int = 0; - let thing = &thing: (*int | int); - let p = match (thing) { + let thing: int = 0; + let thing = &thing: (*int | int); + let p = match (thing) { case int => abort(); case let p: *int => yield p; - }; - *p = 0; + }; + *p = 0; };