diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-17 20:52:23 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-17 20:52:23 +0300 |
| commit | 0d4e9292d85a169f881926556992d4ae12dcb6f4 (patch) | |
| tree | 99229dbacc2f679772ae9ef897b09da0c664b2ff | |
| parent | 395efb9c8a0a0160a7b95769e9484bae5548bbde (diff) | |
| download | ek-0d4e9292d85a169f881926556992d4ae12dcb6f4.tar.gz ek-0d4e9292d85a169f881926556992d4ae12dcb6f4.zip | |
actually enable clang compilation and apply fixes
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | gen/source.mk | 2 | ||||
| -rw-r--r-- | include/ek/ast.h | 6 | ||||
| -rw-r--r-- | src/actualize.c | 8 | ||||
| -rw-r--r-- | src/ast.c | 2 | ||||
| -rw-r--r-- | src/lower.c | 1 | ||||
| -rw-r--r-- | src/main.c | 2 |
7 files changed, 15 insertions, 8 deletions
@@ -17,7 +17,7 @@ all: setup .PHONY: analyze analyze: setup - CC='gcc -fanalyzer' $(MAKE) + CC='gcc -fanalyzer' SKIP_ANALYZER='-fno-analyzer' $(MAKE) .PHONY: setup setup: diff --git a/gen/source.mk b/gen/source.mk index 162864f..700f12a 100644 --- a/gen/source.mk +++ b/gen/source.mk @@ -6,4 +6,4 @@ gen/gen_lexer.inc: src/lexer.l build/gen/parser.o: gen/gen_parser.c mkdir -p build/gen - $(COMPILE_EK) -fno-analyzer -c gen/gen_parser.c -o build/gen/parser.o + $(COMPILE_EK) $(SKIP_ANALYZER) -c gen/gen_parser.c -o build/gen/parser.o diff --git a/include/ek/ast.h b/include/ek/ast.h index 53bc8d6..610efb6 100644 --- a/include/ek/ast.h +++ b/include/ek/ast.h @@ -291,6 +291,7 @@ static inline bool is_binop(struct ast *x) case AST_RSHIFT: return true; default: + break; }; return false; @@ -308,6 +309,7 @@ static inline bool is_opassign(struct ast *x) case AST_ASSIGN_RSHIFT: return true; default: + break; }; return false; } @@ -321,6 +323,7 @@ static inline bool is_unop(struct ast *x) case AST_NEG: return true; default: + break; } return false; @@ -337,6 +340,7 @@ static inline bool is_comparison(struct ast *x) case AST_EQ: return true; default: + break; } return false; @@ -351,6 +355,7 @@ static inline bool is_const(struct ast *x) case AST_CONST_BOOL: return true; default: + break; } return false; @@ -365,6 +370,7 @@ static inline bool is_primitive(struct type *t) case TYPE_PTR: return true; default: + break; } return false; 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; @@ -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; @@ -32,7 +32,7 @@ static const char *cmdline_usage = /** Print usage of compiler. */ static void usage() { - fprintf(stderr, cmdline_usage); + fputs(cmdline_usage, stderr); } /** |
