From 98a74e431c4df8c9c0e61a3c0bac22327717b82d Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 3 Feb 2022 09:52:06 +0530 Subject: [PATCH] spi_flash: fix unused variable warning with SPI_FLASH_DANGEROUS_WRITE_ALLOWED Closes https://github.com/espressif/esp-idf/issues/8329 Closes IDFGH-6700 --- components/spi_flash/flash_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/spi_flash/flash_ops.c b/components/spi_flash/flash_ops.c index f40925edb2..0b6bb8e3f6 100644 --- a/components/spi_flash/flash_ops.c +++ b/components/spi_flash/flash_ops.c @@ -126,7 +126,8 @@ const DRAM_ATTR spi_flash_guard_funcs_t g_flash_guard_no_os_ops = { bootloader, partition table, or running application region. */ #if CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED -#define CHECK_WRITE_ADDRESS(ADDR, SIZE) +// Following helps in masking "unused variable" warning +#define CHECK_WRITE_ADDRESS(ADDR, SIZE) ({(void) guard;}) #else /* FAILS or ABORTS */ #define CHECK_WRITE_ADDRESS(ADDR, SIZE) do { \ if (guard && guard->is_safe_write_address && !guard->is_safe_write_address(ADDR, SIZE)) { \