Skip to content

Commit 539e0b7

Browse files
committed
fix: include vm_dispatch in lib and fix compiler warnings
1 parent efdfe61 commit 539e0b7

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,19 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
124124
include_directories(include)
125125
include_directories(src)
126126

127-
# --- Library Sources ---
127+
# List of all C/C++ source files for the library, excluding those with a 'main' function
128128
file(GLOB_RECURSE LIB_SOURCES
129-
"src/*.c"
129+
"src/*.c"
130130
"src/*.cpp"
131131
)
132-
# Exclude main entry point from library
133-
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*main\\.c$")
134-
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*vm_v2\\.c$")
135-
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*vm_dispatch\\.c$")
136-
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*instr_handlers_template\\.c$")
137-
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*vm_register\\.c$")
132+
133+
# Explicitly exclude files that contain a 'main()' function or are specific VM implementations
134+
list(REMOVE_ITEM LIB_SOURCES
135+
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.c"
136+
"${CMAKE_CURRENT_SOURCE_DIR}/src/vm/vm_v2.c"
137+
"${CMAKE_CURRENT_SOURCE_DIR}/src/vm/vm_register.c"
138+
"${CMAKE_CURRENT_SOURCE_DIR}/src/instr_handlers_template.c"
139+
)
138140

139141
# --- Build Configuration ---
140142
option(PROX_STATIC_BUILD "Build as a single static executable" ON)

build_yml_ca17b9e8.txt

Whitespace-only changes.

src/vm/bytecode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int64_t read_sleb128_from(const uint8_t *buf, size_t buf_len, size_t *out_read)
136136
int64_t result = 0;
137137
unsigned shift = 0;
138138
size_t i = 0;
139-
uint8_t byte;
139+
uint8_t byte = 0;
140140
do {
141141
if (i >= buf_len) break;
142142
byte = buf[i++];

src/vm/disasm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static size_t constant_instruction(const char* name, const Chunk* chunk, size_t
5656
static size_t jump_instruction(const char* name, int sign, const Chunk* chunk, size_t offset) {
5757
uint16_t jump = (uint16_t)(chunk->code[offset + 1] << 8);
5858
jump |= chunk->code[offset + 2];
59-
printf("%-16s %4d -> %d\n", name, offset,
60-
offset + 3 + sign * jump);
59+
printf("%-16s %4zu -> %zu\n", name, offset,
60+
offset + 3 + sign * (size_t)jump);
6161
return offset + 3;
6262
}
6363

0 commit comments

Comments
 (0)