asm: fix all compiler warnings

This commit is contained in:
2024-12-13 17:20:58 +00:00
parent b3a9943fe5
commit 9af971c074
7 changed files with 102 additions and 55 deletions

View File

@@ -17,7 +17,7 @@ struct constpool_parser_state {
} s_current_pval_val;
bool s_current_index_set;
unsigned int s_current_index;
size_t s_current_index;
};
static enum ivy_status parse_linefeed(struct ivy_asm_parser *ctx, struct ivy_asm_token *tok)
@@ -32,37 +32,66 @@ static enum ivy_status parse_linefeed(struct ivy_asm_parser *ctx, struct ivy_asm
return IVY_OK;
}
enum ivy_status status = IVY_OK;
ivy_extended_data_key key = IVY_EX_DATA_KEY_NULL;
struct ivy_asm_token *tmp = NULL;
switch (state->s_current_pval_type) {
case IVY_ASM_PVAL_IDENT:
status = ivy_assembler_put_pval(
ctx->p_assembler, IVY_ASM_PVAL_IDENT,
state->s_base.s_previous_value, &key);
if (status != IVY_OK) {
return status;
}
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_IDENT);
entry.e_ex_handle = b_i32_htob(ivy_assembler_put_pval(ctx->p_assembler, IVY_ASM_PVAL_IDENT, state->s_current_index, state->s_base.s_previous_value));
entry.e_ex_handle = b_i32_htob(key);
ivy_ident_destroy(state->s_base.s_previous_value);
break;
case IVY_ASM_PVAL_ATOM:
tmp = state->s_base.s_previous_value;
status = ivy_assembler_put_pval(
ctx->p_assembler, IVY_ASM_PVAL_ATOM, tmp->t_str, &key);
if (status != IVY_OK) {
return status;
}
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_ATOM);
entry.e_ex_handle = b_i32_htob(ivy_assembler_put_pval(ctx->p_assembler, IVY_ASM_PVAL_ATOM, state->s_current_index, tmp->t_str));
entry.e_ex_handle = b_i32_htob(key);
ivy_asm_token_destroy(tmp);
break;
case IVY_ASM_PVAL_SINT:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_INT);
entry.e_int = b_i32_htob(state->s_current_pval_val.tok->t_int.v);
entry.e_int = b_i32_htob((uint32_t)state->s_current_pval_val.tok->t_int.v);
break;
case IVY_ASM_PVAL_UINT:
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_UINT);
entry.e_int = b_i32_htob(state->s_current_pval_val.tok->t_int.uv);
entry.e_int = b_i32_htob(
(uint32_t)state->s_current_pval_val.tok->t_int.uv);
break;
case IVY_ASM_PVAL_SELECTOR:
status = ivy_assembler_put_pval(
ctx->p_assembler, IVY_ASM_PVAL_SELECTOR,
state->s_base.s_previous_value, &key);
if (status != IVY_OK) {
return status;
}
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_SELECTOR);
entry.e_ex_handle = b_i32_htob(ivy_assembler_put_pval(ctx->p_assembler, IVY_ASM_PVAL_SELECTOR, state->s_current_index, state->s_base.s_previous_value));
entry.e_ex_handle = b_i32_htob(key);
ivy_selector_destroy(state->s_base.s_previous_value);
break;
case IVY_ASM_PVAL_STRING:
tmp = state->s_current_pval_val.tok;
status = ivy_assembler_put_pval(
ctx->p_assembler, IVY_ASM_PVAL_STRING, tmp->t_str, &key);
if (status != IVY_OK) {
return status;
}
entry.e_type = b_i32_htob(IVY_CONSTPOOL_TABLE_STRING);
entry.e_ex_handle = b_i32_htob(ivy_assembler_put_pval(ctx->p_assembler, IVY_ASM_PVAL_STRING, state->s_current_index, tmp->t_str));
entry.e_ex_handle = b_i32_htob(key);
ivy_asm_token_destroy(tmp);
break;
default:

View File

@@ -48,7 +48,7 @@ void ivy_asm_parser_set_assembler(
static token_parse_function get_token_parser(struct parser_state *state, struct ivy_asm_token *tok)
{
struct parser_state_type *type = state->s_type;
const struct parser_state_type *type = state->s_type;
if (!type) {
return NULL;
}
@@ -103,7 +103,7 @@ enum ivy_status ivy_asm_parser_push_token(
return f(p, tok);
}
static struct parser_state_type *get_parser_state_type(enum parser_state_type_id type)
static const struct parser_state_type *get_parser_state_type(enum parser_state_type_id type)
{
if (type < 0 || type >= nr_parser_state_types) {
return NULL;
@@ -114,7 +114,7 @@ static struct parser_state_type *get_parser_state_type(enum parser_state_type_id
struct parser_state *asm_parser_push_state(struct ivy_asm_parser *parser, enum parser_state_type_id type)
{
struct parser_state_type *type_info = get_parser_state_type(type);
const struct parser_state_type *type_info = get_parser_state_type(type);
if (!type_info) {
return NULL;