From 25395553d725092aea5ee62dc6b257f07c99eb2b Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sat, 19 Apr 2025 21:11:10 +0100 Subject: [PATCH] Fix codegen hidden bugs --- Makefile | 7 +++++-- codegen/dbl_list/make_dbl_list.py | 7 ++++--- src/containers/dbl_list/dbl_list.c | 2 -- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9c4d7cb..e8a5432 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,9 @@ ifeq ($(CC),gcc) export ASAN_OPTIONS=verify_asan_link_order=0 endif -.PHONY: all clean builddir build-test run-test build-lib full prng testing uuid core containers +.PHONY: all clean builddir build-test run-test codegen build-lib full prng testing uuid core containers -all: clean builddir run-test full +all: clean builddir codegen run-test full clean: @rm -rf $(BUILD_DIR) @@ -41,6 +41,9 @@ run-test: build-test @$(TEST_OUT) @rm $(TEST_OUT) +codegen: + python3 -m codegen + build-lib: $(CC) $(CFLAGS) $(LIBFLAGS) $(LIB_SRC) -o $(LIB_OUT) diff --git a/codegen/dbl_list/make_dbl_list.py b/codegen/dbl_list/make_dbl_list.py index c9ae31b..70cc8fe 100644 --- a/codegen/dbl_list/make_dbl_list.py +++ b/codegen/dbl_list/make_dbl_list.py @@ -69,7 +69,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}): header = CHeader( name="dbl_list", - decl_types=common_decl_types, + decl_types=[*common_decl_types], includes=[], types=[], funcs=[] @@ -77,6 +77,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}): source = CSource( name=header.name, + decl_types=[*common_decl_types], includes=[CInclude(header, local=True, same_dir=True), CInclude(header="stddef.h")], internal_funcs=[], funcs=header.funcs @@ -90,7 +91,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}): type_string = get_datatype_string(_type) node = CStruct( - name=f"{type_string.title()}Node", + name=dbl_list_data.node_typename, cargs=[ CArg(name="item", _type=type_string, pointer=CPointer(_type=CPointerType.SINGLE)), ], @@ -101,7 +102,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}): ]) dl_list = CStruct( - name=f"{type_string.title()}List", + name=dbl_list_data.list_typename, cargs=[ CArg(name="first", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)), CArg(name="last", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)), diff --git a/src/containers/dbl_list/dbl_list.c b/src/containers/dbl_list/dbl_list.c index 9ddc08e..95ac0c2 100644 --- a/src/containers/dbl_list/dbl_list.c +++ b/src/containers/dbl_list/dbl_list.c @@ -6,8 +6,6 @@ #include "../../common/aliases/aliases.h" #include -typedef struct str8 Str8; - internal Str8List str8_node_to_list(Str8Node *node); Str8Node *wapp_str8_list_get(const Str8List *list, u64 index) {