From 0d26c89b6bdb8327220477bae3b747de71a0c135 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 18 Feb 2021 10:15:56 +1100 Subject: [PATCH] btc_common: Redefine BTC assert macro to use standard assert Allows assert to be disabled, made silent, etc. Progress towards https://github.com/espressif/esp-idf/issues/6306 --- components/bt/host/bluedroid/btc/core/btc_dm.c | 2 +- components/bt/host/bluedroid/btc/include/btc/btc_common.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/btc/core/btc_dm.c b/components/bt/host/bluedroid/btc/core/btc_dm.c index 1f9c7619595f..754745be95c0 100644 --- a/components/bt/host/bluedroid/btc/core/btc_dm.c +++ b/components/bt/host/bluedroid/btc/core/btc_dm.c @@ -342,7 +342,7 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) ) #endif if (1) { - bt_status_t ret; + bt_status_t ret __attribute__((unused)); BTC_TRACE_DEBUG("%s: Storing link key. key_type=0x%x", __FUNCTION__, p_auth_cmpl->key_type); ret = btc_storage_add_bonded_device(&bd_addr, diff --git a/components/bt/host/bluedroid/btc/include/btc/btc_common.h b/components/bt/host/bluedroid/btc/include/btc/btc_common.h index ae4501b5a803..ed225db75835 100644 --- a/components/bt/host/bluedroid/btc/include/btc/btc_common.h +++ b/components/bt/host/bluedroid/btc/include/btc/btc_common.h @@ -16,12 +16,12 @@ #ifndef __BTC_COMMON_H__ #define __BTC_COMMON_H__ +#include #include "common/bt_trace.h" #include "stack/bt_types.h" #include "osi/osi.h" -#define BTC_ASSERTC(cond, msg, val) if (!(cond)) { LOG_ERROR( \ - "### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);} +#define BTC_ASSERTC(cond, msg, val) assert(cond && msg) #define BTC_HAL_CBACK(P_CB, P_CBACK, ...)\ if (P_CB && P_CB->P_CBACK) { \