From bd567cf04605e8099cc06fa243df74dcf6704584 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 2 Jul 2026 07:55:13 +0530 Subject: [PATCH 1/2] fix(wpa_supplicant): fix unused-but-set-variable warnings with GCC 16 GCC 16 raised the default level of -Wunused-but-set-variable and now flags variables that are only used to update themselves. Remove the 'removed' counter in pmksa_cache_flush() (its only read was commented out) and mark the EAP-FAST PAC entry counters as unused, since their only read is inside wpa_printf(MSG_DEBUG, ...) which compiles to a no-op when debug logging is disabled. --- .../wpa_supplicant/src/eap_peer/eap_fast_pac.c | 15 +++++++++++---- .../wpa_supplicant/src/rsn_supp/pmksa_cache.c | 4 ---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c b/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c index 940eeb7f813..70bac4bdf0f 100644 --- a/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c +++ b/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c @@ -414,7 +414,8 @@ int eap_fast_load_pac(struct eap_sm *sm, struct eap_fast_pac **pac_root, { struct eap_fast_read_ctx rc; struct eap_fast_pac *pac = NULL; - int count = 0; + /* count is only consumed by debug logging */ + int count __attribute__((unused)) = 0; char *pos; const char *err = NULL; @@ -623,7 +624,9 @@ int eap_fast_save_pac(struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file) { struct eap_fast_pac *pac; - int ret, count = 0; + int ret; + /* count is only consumed by debug logging */ + int count __attribute__((unused)) = 0; char *buf, *pos; size_t buf_len; @@ -754,7 +757,9 @@ int eap_fast_load_pac_bin(struct eap_sm *sm, struct eap_fast_pac **pac_root, { const struct wpa_config_blob *blob = NULL; u8 *buf, *end, *pos; - size_t len, count = 0; + size_t len; + /* count is only consumed by debug logging */ + size_t count __attribute__((unused)) = 0; struct eap_fast_pac *pac, *prev; *pac_root = NULL; @@ -876,7 +881,9 @@ parse_fail: int eap_fast_save_pac_bin(struct eap_sm *sm, struct eap_fast_pac *pac_root, const char *pac_file) { - size_t len, count = 0; + size_t len; + /* count is only consumed by debug logging */ + size_t count __attribute__((unused)) = 0; struct eap_fast_pac *pac; u8 *buf, *pos; diff --git a/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c b/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c index 710de74ef17..584e8a7a8ff 100644 --- a/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c +++ b/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c @@ -280,7 +280,6 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx, const u8 *pmk, size_t pmk_len) { struct rsn_pmksa_cache_entry *entry, *prev = NULL, *tmp; - int removed = 0; entry = pmksa->pmksa; while (entry) { @@ -298,14 +297,11 @@ void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx, tmp = entry; entry = entry->next; pmksa_cache_free_entry(pmksa, tmp, PMKSA_FREE); - removed++; } else { prev = entry; entry = entry->next; } } - /*if (removed) - pmksa_cache_set_expiration(pmksa);*/ } From e16593ebc063ecdfdf89acc846c20bb5d2a459e1 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 2 Jul 2026 07:55:14 +0530 Subject: [PATCH 2/2] fix(esp_psram): fix unused-but-set-variable warning with GCC 16 GCC 16 flags the volatile accumulator in the cache writeback loops even though it is volatile, as it is only used to update itself. Drop the accumulator and rely on the volatile-qualified psram pointer to keep the cache-line reads from being optimized out. --- components/esp_psram/esp32/esp_psram_extram_cache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/esp_psram/esp32/esp_psram_extram_cache.c b/components/esp_psram/esp32/esp_psram_extram_cache.c index 1ee185e1ed2..7cfc1047376 100644 --- a/components/esp_psram/esp32/esp_psram_extram_cache.c +++ b/components/esp_psram/esp32/esp_psram_extram_cache.c @@ -24,7 +24,6 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) { int x; - volatile int i = 0; volatile uint8_t *psram = (volatile uint8_t*)SOC_EXTRAM_DATA_LOW; int cache_was_disabled = 0; @@ -51,7 +50,7 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) the cache by just reading 64K worth of cache lines. */ for (x = 0; x < 1024 * 64; x += 32) { - i += psram[x]; + (void)psram[x]; } #else /* @@ -61,8 +60,8 @@ void IRAM_ATTR esp_psram_extram_writeback_cache(void) we ever support external RAM chips of 2M or smaller, this may need adjusting. */ for (x = 0; x < 1024 * 64; x += 32) { - i += psram[x]; - i += psram[x + (1024 * 1024 * 2)]; + (void)psram[x]; + (void)psram[x + (1024 * 1024 * 2)]; } #endif