Suppress new GCC 12 warning (#842)
This commit is contained in:
@ -12,9 +12,6 @@
|
||||
// Returns the 32 bit pointer into the ROM if found or NULL otherwise.
|
||||
typedef void *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);
|
||||
|
||||
// Convert a 16 bit pointer stored at the given rom address into a 32 bit pointer
|
||||
#define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
|
||||
|
||||
void *rom_func_lookup(uint32_t code) {
|
||||
return rom_func_lookup_inline(code);
|
||||
}
|
||||
|
@ -116,8 +116,18 @@ bool rom_funcs_lookup(uint32_t *table, unsigned int count);
|
||||
// Returns the 32 bit pointer into the ROM if found or NULL otherwise.
|
||||
typedef void *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 12)
|
||||
// Convert a 16 bit pointer stored at the given rom address into a 32 bit pointer
|
||||
#define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
|
||||
static inline void *rom_hword_as_ptr(uint16_t rom_address) {
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
return (void *)(uintptr_t)*(uint16_t *)(uintptr_t)rom_address;
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
#else
|
||||
// Convert a 16 bit pointer stored at the given rom address into a 32 bit pointer
|
||||
#define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)(uintptr_t)(rom_address))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Lookup a bootrom function by code. This method is forceably inlined into the caller for FLASH/RAM sensitive code usage
|
||||
|
Reference in New Issue
Block a user