Fix codegen hidden bugs

This commit is contained in:
Abdelrahman Said 2025-04-19 21:11:10 +01:00
parent 9a651665ba
commit 25395553d7
3 changed files with 9 additions and 7 deletions

View File

@ -24,9 +24,9 @@ ifeq ($(CC),gcc)
export ASAN_OPTIONS=verify_asan_link_order=0 export ASAN_OPTIONS=verify_asan_link_order=0
endif 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: clean:
@rm -rf $(BUILD_DIR) @rm -rf $(BUILD_DIR)
@ -41,6 +41,9 @@ run-test: build-test
@$(TEST_OUT) @$(TEST_OUT)
@rm $(TEST_OUT) @rm $(TEST_OUT)
codegen:
python3 -m codegen
build-lib: build-lib:
$(CC) $(CFLAGS) $(LIBFLAGS) $(LIB_SRC) -o $(LIB_OUT) $(CC) $(CFLAGS) $(LIBFLAGS) $(LIB_SRC) -o $(LIB_OUT)

View File

@ -69,7 +69,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}):
header = CHeader( header = CHeader(
name="dbl_list", name="dbl_list",
decl_types=common_decl_types, decl_types=[*common_decl_types],
includes=[], includes=[],
types=[], types=[],
funcs=[] funcs=[]
@ -77,6 +77,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}):
source = CSource( source = CSource(
name=header.name, name=header.name,
decl_types=[*common_decl_types],
includes=[CInclude(header, local=True, same_dir=True), CInclude(header="stddef.h")], includes=[CInclude(header, local=True, same_dir=True), CInclude(header="stddef.h")],
internal_funcs=[], internal_funcs=[],
funcs=header.funcs funcs=header.funcs
@ -90,7 +91,7 @@ def make_dbl_list(user_datatypes: dict[CDataType, DblListData] = {}):
type_string = get_datatype_string(_type) type_string = get_datatype_string(_type)
node = CStruct( node = CStruct(
name=f"{type_string.title()}Node", name=dbl_list_data.node_typename,
cargs=[ cargs=[
CArg(name="item", _type=type_string, pointer=CPointer(_type=CPointerType.SINGLE)), 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( dl_list = CStruct(
name=f"{type_string.title()}List", name=dbl_list_data.list_typename,
cargs=[ cargs=[
CArg(name="first", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)), CArg(name="first", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)),
CArg(name="last", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)), CArg(name="last", _type=node, pointer=CPointer(_type=CPointerType.SINGLE)),

View File

@ -6,8 +6,6 @@
#include "../../common/aliases/aliases.h" #include "../../common/aliases/aliases.h"
#include <stddef.h> #include <stddef.h>
typedef struct str8 Str8;
internal Str8List str8_node_to_list(Str8Node *node); internal Str8List str8_node_to_list(Str8Node *node);
Str8Node *wapp_str8_list_get(const Str8List *list, u64 index) { Str8Node *wapp_str8_list_get(const Str8List *list, u64 index) {