asm: fix compiler warnings

This commit is contained in:
2024-12-14 21:03:44 +00:00
parent 462f67c6aa
commit a167dd2af5
8 changed files with 150 additions and 117 deletions

View File

@@ -1,12 +1,12 @@
#include "assembler.h"
#include <ivy/asm/bin.h>
#include <ivy/ident.h>
#include <ivy/selector.h>
#include <blue/core/hash.h>
#include <blue/object/dict.h>
#include <blue/object/number.h>
#include <blue/object/string.h>
#include <blue/core/hash.h>
#include <ivy/asm/bin.h>
#include <ivy/ident.h>
#include <ivy/selector.h>
#include <stdlib.h>
#include <string.h>
@@ -23,7 +23,8 @@ static enum ivy_status init_scope(
assembler_write_data(as, &header, sizeof header);
struct constpool_assembler_scope *c = (struct constpool_assembler_scope *)scope;
struct constpool_assembler_scope *c
= (struct constpool_assembler_scope *)scope;
c->s_strings = b_dict_create();
return IVY_OK;
@@ -49,7 +50,8 @@ static void put_cached_string(
static ivy_extended_data_key write_string(struct ivy_assembler *as, const char *s)
{
struct constpool_assembler_scope *scope = (struct constpool_assembler_scope *)assembler_get_scope(as);
struct constpool_assembler_scope *scope
= (struct constpool_assembler_scope *)assembler_get_scope(as);
ivy_extended_data_key key = get_cached_string(scope, s);
if (key != IVY_EX_DATA_KEY_NULL) {
@@ -58,10 +60,10 @@ static ivy_extended_data_key write_string(struct ivy_assembler *as, const char *
size_t len = strlen(s);
struct ivy_bin_string str = { 0 };
struct ivy_bin_string str = {0};
str.s_hash = b_i32_htob((uint32_t)b_hash_string(s));
str.s_len = b_i32_htob((uint32_t)len);
key = assembler_write_extended_data(as, &str, sizeof str);
/* include the trailing null terminator. */
@@ -100,7 +102,8 @@ static ivy_extended_data_key write_selector(
b_queue_iterator it = {0};
b_queue_foreach (&it, &sel->sel_args) {
struct ivy_selector_arg *arg = b_unbox(struct ivy_selector_arg, it.entry, arg_entry);
struct ivy_selector_arg *arg
= b_unbox(struct ivy_selector_arg, it.entry, arg_entry);
arg_handles[i++] = write_string(as, arg->arg_label);
}
@@ -128,15 +131,16 @@ static ivy_extended_data_key write_ident(
= calloc(nr_parts, sizeof(ivy_extended_data_key));
b_queue_iterator it = {0};
b_queue_foreach (&it, &id->id_parts) {
struct ivy_ident_part *arg = b_unbox(struct ivy_ident_part, it.entry, p_entry);
struct ivy_ident_part *arg
= b_unbox(struct ivy_ident_part, it.entry, p_entry);
part_handles[i++] = write_string(as, arg->p_str);
}
dat.id_nr_parts = (uint8_t)nr_parts;
ivy_extended_data_key ident_handle
= assembler_write_extended_data(as, &dat, sizeof dat);
for (i = 0; i < nr_parts; i++) {
b_i32 part_handle = b_i32_htob(part_handles[i]);
assembler_write_extended_data(as, &part_handle, sizeof part_handle);
@@ -148,7 +152,8 @@ static ivy_extended_data_key write_ident(
static enum ivy_status put_pval(
struct ivy_assembler *as, struct assembler_scope *scope,
enum ivy_assembler_pval_type type, const void *val, ivy_extended_data_key *key)
enum ivy_assembler_pval_type type, const void *val,
ivy_extended_data_key *key)
{
struct ivy_bin_constpool_table_entry entry = {0};
uintptr_t i = *(uintptr_t *)val;
@@ -199,4 +204,4 @@ const struct assembler_scope_type constpool_scope_type = {
.s_scope_size = sizeof(struct constpool_assembler_scope),
.s_init_scope = init_scope,
.s_put_pval = put_pval,
};
};