Skip to content

Commit efe05d8

Browse files
committed
refactor(sleep_cpu): suppress infinite loop warnings with compiler diagnostics
1 parent b922352 commit efe05d8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

components/esp_hw_support/lowpower/port/esp32h4/sleep_cpu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ static IRAM_ATTR void smp_core_do_retention(void)
465465
// Wait another core start to do retention
466466
bool smp_skip_retention = false;
467467
smp_retention_state_t another_core_state;
468+
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop")
468469
while (1) {
469470
another_core_state = atomic_load(&s_smp_retention_state[!core_id]);
470471
if (another_core_state == SMP_SKIP_RETENTION) {
@@ -475,6 +476,7 @@ static IRAM_ATTR void smp_core_do_retention(void)
475476
break;
476477
}
477478
}
479+
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop")
478480

479481
if (!smp_skip_retention) {
480482
atomic_store(&s_smp_retention_state[core_id], SMP_BACKUP_START);
@@ -540,9 +542,11 @@ void sleep_smp_cpu_wakeup_prepare(void)
540542
#if ESP_SLEEP_POWER_DOWN_CPU
541543
uint8_t core_id = esp_cpu_get_core_id();
542544
if (atomic_load(&s_smp_retention_state[core_id]) == SMP_RESTORE_DONE) {
545+
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop")
543546
while (atomic_load(&s_smp_retention_state[!core_id]) != SMP_RESTORE_DONE) {
544547
;
545548
}
549+
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop")
546550
}
547551
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
548552
#else

components/esp_system/port/soc/esp32h21/system_internal.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,5 @@ void esp_restart_noos(void)
133133
// Reset CPU
134134
esp_rom_software_reset_cpu(0);
135135

136-
while (true) {
137-
;
138-
}
136+
ESP_INFINITE_LOOP();
139137
}

0 commit comments

Comments
 (0)