Skip to content

Commit

Permalink
stm32/mboot: Add pragma for GCC to ignore array bounds warning.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Mar 22, 2022
1 parent f0be0de commit dc91024
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ports/stm32/mboot/main.c
Expand Up @@ -788,7 +788,15 @@ void i2c_slave_process_rx_end(i2c_slave_t *i2c) {
if (buf[0] == I2C_CMD_ECHO) {
++len;
} else if (buf[0] == I2C_CMD_GETID && len == 0) {
#if __GNUC__ >= 11
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
memcpy(buf, (uint8_t*)MP_HAL_UNIQUE_ID_ADDRESS, 12);
#if __GNUC__ >= 11
#pragma GCC diagnostic pop
#endif
memcpy(buf + 12, MICROPY_HW_MCU_NAME, sizeof(MICROPY_HW_MCU_NAME));
memcpy(buf + 12 + sizeof(MICROPY_HW_MCU_NAME), MICROPY_HW_BOARD_NAME, sizeof(MICROPY_HW_BOARD_NAME) - 1);
len = 12 + sizeof(MICROPY_HW_MCU_NAME) + sizeof(MICROPY_HW_BOARD_NAME) - 1;
Expand Down

0 comments on commit dc91024

Please sign in to comment.