Skip to content

Commit 827ad32

Browse files
committed
Only ignore warnings if in gcc >= 11
1 parent 3e13d4f commit 827ad32

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ports/raspberrypi/common-hal/nvm/ByteArray.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ static void erase_and_write_sector(uint32_t address, uint32_t len, uint8_t *byte
6565
// Write a whole sector to flash, buffering it first and then erasing and rewriting it
6666
// since we can only erase a whole sector at a time.
6767
uint8_t buffer[FLASH_SECTOR_SIZE];
68+
#pragma GCC diagnostic push
69+
#if __GNUC__ >= 11
6870
// TODO: Update this to a better workaround for GCC 11 when one is provided.
6971
// See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c20
70-
#pragma GCC diagnostic push
7172
#pragma GCC diagnostic ignored "-Warray-bounds"
7273
#pragma GCC diagnostic ignored "-Wstringop-overread"
74+
#endif
7375
memcpy(buffer, (uint8_t *)CIRCUITPY_INTERNAL_NVM_START_ADDR, FLASH_SECTOR_SIZE);
7476
#pragma GCC diagnostic pop
7577
memcpy(buffer + address, bytes, len);

0 commit comments

Comments
 (0)