Only ignore warnings if in gcc >= 11

This commit is contained in:
Scott Shawcroft 2021-12-22 18:21:18 -08:00
parent 3e13d4f5b5
commit 827ad327a5
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 3 additions and 1 deletions

View File

@ -65,11 +65,13 @@ static void erase_and_write_sector(uint32_t address, uint32_t len, uint8_t *byte
// Write a whole sector to flash, buffering it first and then erasing and rewriting it
// since we can only erase a whole sector at a time.
uint8_t buffer[FLASH_SECTOR_SIZE];
#pragma GCC diagnostic push
#if __GNUC__ >= 11
// TODO: Update this to a better workaround for GCC 11 when one is provided.
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c20
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overread"
#endif
memcpy(buffer, (uint8_t *)CIRCUITPY_INTERNAL_NVM_START_ADDR, FLASH_SECTOR_SIZE);
#pragma GCC diagnostic pop
memcpy(buffer + address, bytes, len);