From 49bd0ca8fd8c89996d992ef7780d1d9d5f69cd23 Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Mon, 11 Sep 2023 16:30:07 +0800 Subject: [PATCH] fix(esp_system): suppress compiler warning if ESP_SYSTEM_PANIC_SILENT_REBOOT is enabled --- components/esp_common/include/esp_macros.h | 4 ++++ .../esp_system/include/esp_private/panic_internal.h | 9 +++++---- .../system/build_test/sdkconfig.ci.panic_silent_reboot | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 tools/test_apps/system/build_test/sdkconfig.ci.panic_silent_reboot diff --git a/components/esp_common/include/esp_macros.h b/components/esp_common/include/esp_macros.h index 28aa5106c2..17400cb2b2 100644 --- a/components/esp_common/include/esp_macros.h +++ b/components/esp_common/include/esp_macros.h @@ -46,6 +46,10 @@ extern "C" { #define CHOOSE_MACRO_VA_ARG(MACRO_WITH_ARGS, MACRO_WITH_NO_ARGS, ...) CHOOSE_MACRO_VA_ARG_INN(0, ##__VA_ARGS__, MACRO_WITH_ARGS, MACRO_WITH_NO_ARGS, 0) #endif +#ifndef ESP_UNUSED +#define ESP_UNUSED(x) ((void)(x)) +#endif + /* test macros */ #define foo_args(...) 1 #define foo_no_args() 2 diff --git a/components/esp_system/include/esp_private/panic_internal.h b/components/esp_system/include/esp_private/panic_internal.h index bdf8a26420..10dbdf9f8a 100644 --- a/components/esp_system/include/esp_private/panic_internal.h +++ b/components/esp_system/include/esp_private/panic_internal.h @@ -9,6 +9,7 @@ #include #include +#include "esp_macros.h" #include "soc/soc_caps.h" #include "sdkconfig.h" @@ -62,10 +63,10 @@ void panic_print_str(const char *str); void panic_print_dec(int d); void panic_print_hex(int h); #else -#define panic_print_char(c) -#define panic_print_str(str) -#define panic_print_dec(d) -#define panic_print_hex(h) +#define panic_print_char(c) ESP_UNUSED(c) +#define panic_print_str(str) ESP_UNUSED(str) +#define panic_print_dec(d) ESP_UNUSED(d) +#define panic_print_hex(h) ESP_UNUSED(h) #endif void __attribute__((__noreturn__)) panic_abort(const char *details); diff --git a/tools/test_apps/system/build_test/sdkconfig.ci.panic_silent_reboot b/tools/test_apps/system/build_test/sdkconfig.ci.panic_silent_reboot new file mode 100644 index 0000000000..17a3547391 --- /dev/null +++ b/tools/test_apps/system/build_test/sdkconfig.ci.panic_silent_reboot @@ -0,0 +1,2 @@ +CONFIG_IDF_TARGET="esp32" +CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y