Просмотр исходного кода

fix(esp_system): suppress compiler warning if ESP_SYSTEM_PANIC_SILENT_REBOOT is enabled

wuzhenghui 2 лет назад
Родитель
Сommit
6fea0260a3

+ 4 - 0
components/esp_common/include/esp_macros.h

@@ -75,6 +75,10 @@ extern "C" {
         9, 8, 7, 6, 5, 4, 3, 2, 1, 0
 #endif
 
+#ifndef ESP_UNUSED
+#define ESP_UNUSED(x) ((void)(x))
+#endif
+
 /* test macros */
 #define foo_args(...) 1
 #define foo_no_args() 2

+ 5 - 4
components/esp_system/include/esp_private/panic_internal.h

@@ -9,6 +9,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 
+#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);

+ 2 - 0
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