ignore some cast-align diagnostics

This commit is contained in:
Jeff Epler 2023-08-20 14:26:48 -05:00
parent 1399d0f25b
commit 0cab3359df
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 9 additions and 0 deletions

View File

@ -130,7 +130,10 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k
mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in); mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in);
// Determine start of prelude. // Determine start of prelude.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
uintptr_t prelude_ptr_index = ((uintptr_t *)self_fun->bytecode)[0]; uintptr_t prelude_ptr_index = ((uintptr_t *)self_fun->bytecode)[0];
#pragma GCC diagnostic pop
const uint8_t *prelude_ptr; const uint8_t *prelude_ptr;
if (prelude_ptr_index == 0) { if (prelude_ptr_index == 0) {
prelude_ptr = (void *)self_fun->child_table; prelude_ptr = (void *)self_fun->child_table;

View File

@ -87,10 +87,16 @@ void mp_native_relocate(void *ri_in, uint8_t *text, uintptr_t reloc_text) {
size_t addr = read_uint(ri->reader); size_t addr = read_uint(ri->reader);
if ((addr & 1) == 0) { if ((addr & 1) == 0) {
// Point to somewhere in text // Point to somewhere in text
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
addr_to_adjust = &((uintptr_t *)text)[addr >> 1]; addr_to_adjust = &((uintptr_t *)text)[addr >> 1];
#pragma GCC diagnostic pop
} else { } else {
// Point to somewhere in rodata // Point to somewhere in rodata
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
addr_to_adjust = &((uintptr_t *)ri->rodata)[addr >> 1]; addr_to_adjust = &((uintptr_t *)ri->rodata)[addr >> 1];
#pragma GCC diagnostic pop
} }
} }
op >>= 1; op >>= 1;