summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Brunsfeld <maxbrunsfeld@gmail.com>2023-10-27 12:16:05 +0100
committerMax Brunsfeld <maxbrunsfeld@gmail.com>2023-10-27 12:16:05 +0100
commit81a1a1733d68d821db1d1e7195a1713cb85430a9 (patch)
tree5140e936bcafb7fd0c629340f647adfa6cbef56c
parentf4e2f68f1430b2da88b31f1131126e5929d66c3b (diff)
Fix C compile warnings in wasm.c
-rw-r--r--lib/binding_rust/build.rs1
-rw-r--r--lib/src/wasm.c13
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/binding_rust/build.rs b/lib/binding_rust/build.rs
index 11501300..31dd5fdc 100644
--- a/lib/binding_rust/build.rs
+++ b/lib/binding_rust/build.rs
@@ -38,6 +38,7 @@ fn main() {
.flag_if_supported("-std=c99")
.flag_if_supported("-fvisibility=hidden")
.flag_if_supported("-Wshadow")
+ .flag_if_supported("-Wno-unused-parameter")
.include(src_path)
.include(src_path.join("wasm"))
.include("include")
diff --git a/lib/src/wasm.c b/lib/src/wasm.c
index e168e52d..20794a58 100644
--- a/lib/src/wasm.c
+++ b/lib/src/wasm.c
@@ -579,7 +579,7 @@ TSWasmStore *ts_wasm_store_new(TSWasmEngine *engine) {
if (!store_index) {
printf(" other stdlib name: %.*s\n", (int)name->size, name->data);
}
- }
+ }
}
for (unsigned i = 0; i < STDLIB_SYMBOL_COUNT; i++) {
@@ -614,12 +614,12 @@ static bool ts_wasm_store__instantiate(
// Construct the language function name as string.
unsigned prefix_len = strlen("tree_sitter_");
- unsigned name_len = strlen(language_name);
+ size_t name_len = strlen(language_name);
char language_function_name[prefix_len + name_len + 1];
memcpy(&language_function_name[0], "tree_sitter_", prefix_len);
memcpy(&language_function_name[prefix_len], language_name, name_len);
language_function_name[prefix_len + name_len] = '\0';
-
+
// Construct globals representing the offset in memory and in the function
// table where the module should be added.
wasmtime_val_t table_base_val = WASM_I32_VAL(self->current_function_table_offset);
@@ -644,7 +644,7 @@ static bool ts_wasm_store__instantiate(
wasm_importtype_vec_t import_types = WASM_EMPTY_VEC;
wasmtime_module_imports(module, &import_types);
wasmtime_extern_t imports[import_types.size];
-
+
printf("import count: %lu\n", import_types.size);
for (unsigned i = 0; i < import_types.size; i++) {
const wasm_importtype_t *import_type = import_types.data[i];
@@ -685,7 +685,7 @@ static bool ts_wasm_store__instantiate(
break;
}
}
-
+
if (!defined_in_stdlib) {
printf("unexpected import '%.*s'\n", (int)import_name->size, import_name->data);
return false;
@@ -720,7 +720,6 @@ static bool ts_wasm_store__instantiate(
const wasm_name_t *name = wasm_exporttype_name(export_type);
char *export_name;
- size_t name_len;
wasmtime_extern_t export = {.kind = WASM_EXTERN_GLOBAL};
bool exists = wasmtime_instance_export_nth(context, &instance, i, &export_name, &name_len, &export);
assert(exists);
@@ -1262,4 +1261,4 @@ bool ts_language_is_wasm(const TSLanguage *self) {
return false;
}
-#endif \ No newline at end of file
+#endif