Merge branch 'fix/gcc16_unused_but_set_variable' into 'master'

Fix unused-but-set-variable warnings with GCC 16

See merge request espressif/esp-idf!50282
This commit is contained in:
Mahavir Jain
2026-07-02 13:40:46 +05:30
3 changed files with 14 additions and 12 deletions
@@ -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
@@ -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;
@@ -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);*/
}