Skip to content

Commit 380d76b

Browse files
committed
py/objfun.h: prevent cast-align warnings
1 parent 49fca3f commit 380d76b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

py/objfun.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ static inline mp_obj_t mp_obj_new_fun_viper(const void *fun_data, const mp_modul
7171

7272
static inline const uint8_t *mp_obj_fun_native_get_prelude_ptr(const mp_obj_fun_bc_t *fun_native) {
7373
// Obtain a pointer to the start of the function prelude, based on prelude_ptr_index.
74+
// CIRCUITPY-CHANGE: prevent warning
75+
#pragma GCC diagnostic push
76+
#pragma GCC diagnostic ignored "-Wcast-align"
7477
uintptr_t prelude_ptr_index = ((uintptr_t *)fun_native->bytecode)[0];
78+
#pragma GCC diagnostic pop
7579
const uint8_t *prelude_ptr;
7680
if (prelude_ptr_index == 0) {
7781
prelude_ptr = (const uint8_t *)fun_native->child_table;
@@ -88,13 +92,21 @@ static inline void *mp_obj_fun_native_get_function_start(const mp_obj_fun_bc_t *
8892

8993
static inline void *mp_obj_fun_native_get_generator_start(const mp_obj_fun_bc_t *fun_native) {
9094
// Obtain a pointer to the start of the generator executable machine code.
95+
// CIRCUITPY-CHANGE: prevent warning
96+
#pragma GCC diagnostic push
97+
#pragma GCC diagnostic ignored "-Wcast-align"
9198
uintptr_t start_offset = ((uintptr_t *)fun_native->bytecode)[1];
99+
#pragma GCC diagnostic pop
92100
return MICROPY_MAKE_POINTER_CALLABLE((void *)(fun_native->bytecode + start_offset));
93101
}
94102

95103
static inline void *mp_obj_fun_native_get_generator_resume(const mp_obj_fun_bc_t *fun_native) {
96104
// Obtain a pointer to the resume location of the generator executable machine code.
105+
// CIRCUITPY-CHANGE: prevent warning
106+
#pragma GCC diagnostic push
107+
#pragma GCC diagnostic ignored "-Wcast-align"
97108
return MICROPY_MAKE_POINTER_CALLABLE((void *)&((uintptr_t *)fun_native->bytecode)[2]);
109+
#pragma GCC diagnostic pop
98110
}
99111

100112
#endif

0 commit comments

Comments
 (0)