From 0d4e9292d85a169f881926556992d4ae12dcb6f4 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 17 Aug 2024 20:52:23 +0300 Subject: actually enable clang compilation and apply fixes --- src/actualize.c | 8 ++++---- src/ast.c | 2 +- src/lower.c | 1 + src/main.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/actualize.c b/src/actualize.c index aa5b398..0ea94a9 100644 --- a/src/actualize.c +++ b/src/actualize.c @@ -1534,6 +1534,7 @@ static int integral_type(struct type *type) case TYPE_BOOL: return true; /* maybe? */ default: + break; } return false; @@ -1560,14 +1561,12 @@ static int pointer_conversion(struct type *a, struct type *b) static struct ast *lookup_enum_member(struct ast *enu, char *find) { - size_t i = 0; struct ast *m = enum_body(enu); while (m) { assert(m->k == AST_VAL); if (same_id(find, val_id(m))) break; m = m->n; - i++; } return m; @@ -1946,6 +1945,7 @@ static int _replace_type_id(struct type *type, void *data) } default: + break; } return 0; @@ -2608,7 +2608,7 @@ static int actualize_continue(struct act_state *state, struct scope *scope, { UNUSED(scope); node->t = void_type(); - if (!state->flags & ACT_IN_LOOP) { + if (!(state->flags & ACT_IN_LOOP)) { semantic_error(scope->fctx, node, "continue outside of loop"); return -1; @@ -2623,7 +2623,7 @@ static int actualize_break(struct act_state *state, struct scope *scope, { UNUSED(scope); node->t = void_type(); - if (!state->flags & ACT_IN_LOOP) { + if (!(state->flags & ACT_IN_LOOP)) { semantic_error(scope->fctx, node, "break outside of loop"); return -1; diff --git a/src/ast.c b/src/ast.c index f178e41..113357b 100644 --- a/src/ast.c +++ b/src/ast.c @@ -725,7 +725,7 @@ size_t type_size(struct type *t) case TYPE_I27: return 3; case TYPE_PTR: return 3; case TYPE_STRUCT: return struct_size(t); - default: + default: break; } assert(0 && "unhandled type to get size of"); diff --git a/src/lower.c b/src/lower.c index 4093cbf..e6c147f 100644 --- a/src/lower.c +++ b/src/lower.c @@ -128,6 +128,7 @@ static bool is_small_type(struct type *type) return true; default: + break; } return false; diff --git a/src/main.c b/src/main.c index b3e2b2b..fb9cdb8 100644 --- a/src/main.c +++ b/src/main.c @@ -32,7 +32,7 @@ static const char *cmdline_usage = /** Print usage of compiler. */ static void usage() { - fprintf(stderr, cmdline_usage); + fputs(cmdline_usage, stderr); } /** -- cgit v1.3