From 26cb374c1d0c3d3e442f6533157c4336f5ff4022 Mon Sep 17 00:00:00 2001 From: omicron Date: Thu, 17 Apr 2025 15:09:29 +0200 Subject: [PATCH 1/5] Update gitignore, add /build and remove old build artifacts --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ab02f7f..e025a97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *.o *.d /core -/oas -/oas-asan -/oas-msan +/build /reports -- 2.47.2 From 1a79bf050e05057913bf374444d3f305fb1666cb Mon Sep 17 00:00:00 2001 From: omicron Date: Thu, 17 Apr 2025 15:10:36 +0200 Subject: [PATCH 2/5] Remove unused ast_node_free_value Values are all inside the ast struct and require no cleanup other than freeing the ast struct. --- src/ast.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/ast.c b/src/ast.c index d9275f7..4691264 100644 --- a/src/ast.c +++ b/src/ast.c @@ -17,10 +17,6 @@ error_t *ast_node_alloc(ast_node_t **output) { return nullptr; } -void ast_node_free_value(ast_node_t *node) { - // TODO: decide how value ownership will work and clean it up here -} - void ast_node_free(ast_node_t *node) { if (node == nullptr) return; @@ -30,8 +26,6 @@ void ast_node_free(ast_node_t *node) { free(node->children); } - ast_node_free_value(node); - memset(node, 0, sizeof(ast_node_t)); free(node); } -- 2.47.2 From 6f78d26ea1a4942a3319412f9449a406ed5c2af5 Mon Sep 17 00:00:00 2001 From: omicron Date: Thu, 17 Apr 2025 15:12:56 +0200 Subject: [PATCH 3/5] Change the n argument of lexer_shift_buffer to size_t from int --- src/lexer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lexer.c b/src/lexer.c index 94087b6..292befe 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -136,7 +136,7 @@ error_t *lexer_open(lexer_t *lex, char *path) { * * @pre There must be at least n characters in the input buffer */ -void lexer_shift_buffer(lexer_t *lex, int n) { +void lexer_shift_buffer(lexer_t *lex, size_t n) { assert(lex->buffer_count >= n); lex->buffer_count -= n; memmove(lex->buffer, lex->buffer + n, lex->buffer_count); -- 2.47.2 From bf3fd83b648d46dab6de6a97fd5c07df9e0159b5 Mon Sep 17 00:00:00 2001 From: omicron Date: Thu, 17 Apr 2025 15:18:28 +0200 Subject: [PATCH 4/5] Let the release build error on warnings Add -Werror to the release configuration. Also add the release build as a dependency of the make validate rule. The idea is that builds should not pass validation if they have warnings but it shouldn't stop debug builds during development from compiling while work is in progress. --- Makefile | 2 +- make/release.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1983303..a6b1f0b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ asan: msan: make -rRf make/msan.mk all -validate: asan msan debug +validate: asan msan debug release ./validate.sh analyze: diff --git a/make/release.mk b/make/release.mk index 606940c..d58017b 100644 --- a/make/release.mk +++ b/make/release.mk @@ -1,4 +1,4 @@ -CFLAGS?=-Wall -Wextra -Wpedantic -O2 -std=c23 -flto -fomit-frame-pointer -DNDEBUG -D_POSIX_C_SOURCE=200809L +CFLAGS?=-Wall -Wextra -Wpedantic -Werror -O2 -std=c23 -flto -fomit-frame-pointer -DNDEBUG -D_POSIX_C_SOURCE=200809L LDFLAGS?=-flto -s -Wl,--gc-sections BUILD_DIR?=build/release/ -- 2.47.2 From ea5164e5840b49707520e74c2cfcb77c77dc0753 Mon Sep 17 00:00:00 2001 From: omicron Date: Thu, 17 Apr 2025 16:35:23 +0200 Subject: [PATCH 5/5] Make compiler-rt version match the clang version in the gitea action --- .gitea/workflows/validate.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml index a922e39..4f64dc8 100644 --- a/.gitea/workflows/validate.yaml +++ b/.gitea/workflows/validate.yaml @@ -16,8 +16,10 @@ jobs: echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories + # determine correct clang version and then install it apk update - apk add --no-cache llvm19 clang19 clang19-analyzer compiler-rt valgrind + RT_VERSION=$(apk search -v compiler-rt | grep -o "compiler-rt-[0-9]*" | head -1 | grep -o "[0-9]*") + apk add --no-cache llvm${RT_VERSION} clang${RT_VERSION} clang${RT_VERSION}-analyzer compiler-rt valgrind # Verify versions echo "---------------------" -- 2.47.2