From 956e229bf678bda2d98cd716ea9b77ea8405288a Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Wed, 8 Jul 2026 21:04:55 +0800 Subject: [PATCH] fix(openthread): add ESP_RETURN_VOID_ON_FALSE for IDF 5.2 compatibility --- .../esp_openthread_common_macro.h | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/components/openthread/private_include/esp_openthread_common_macro.h b/components/openthread/private_include/esp_openthread_common_macro.h index 8595bc7684b..5c45ce2e3c4 100644 --- a/components/openthread/private_include/esp_openthread_common_macro.h +++ b/components/openthread/private_include/esp_openthread_common_macro.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -42,3 +42,23 @@ #else #define ESP_OPENTHREAD_ASSERT(a) assert(a) #endif + +#ifndef ESP_RETURN_VOID_ON_FALSE +#if defined(CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT) +#define ESP_RETURN_VOID_ON_FALSE(a, log_tag, format, ...) \ + do { \ + (void)log_tag; \ + if (unlikely(!(a))) { \ + return; \ + } \ + } while (0) +#else +#define ESP_RETURN_VOID_ON_FALSE(a, log_tag, format, ...) \ + do { \ + if (unlikely(!(a))) { \ + ESP_LOGE(log_tag, "%s(%d): " format, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ + return; \ + } \ + } while (0) +#endif +#endif