Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ceb4619b authored by Sharvil Nanavati's avatar Sharvil Nanavati Committed by Andre Eisenbach
Browse files

Eliminate unusable wcassert code in favor of plain old C asssert.

The WC_* macros only expand to something meaningful when _DEBUG is
also defined. However, on enabling _DEBUG, bluedroid fails to build
because the wc_assert function is not defined anywhere. We can get
what I imagine is the equivalent behavior by switching over to the
standard C assert macro.
parent 85b1baf4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -22,7 +22,9 @@
 *
 ******************************************************************************/

#include <assert.h>
#include <string.h>

#include "bt_types.h"
#include "bt_target.h"
#include "bt_utils.h"
@@ -31,7 +33,6 @@
#include "avdt_int.h"
#include "l2c_api.h"
#include "l2cdefs.h"
#include "wcassert.h"


/*******************************************************************************
@@ -245,7 +246,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_
        }
    }

    WC_ASSERT(i != AVDT_NUM_TC_TBL);
    assert(i != AVDT_NUM_TC_TBL);

    return p_tbl;
}
@@ -276,7 +277,7 @@ tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb)
    }

    /* sanity check */
    WC_ASSERT(i != AVDT_NUM_TC_TBL);
    assert(i != AVDT_NUM_TC_TBL);

    /* initialize entry */
    p_tbl->peer_mtu = L2CAP_DEFAULT_MTU;
+5 −5
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@
 *  Interface to AVRCP mandatory commands
 *
 ******************************************************************************/
#include <assert.h>
#include <string.h>

#include "gki.h"
#include "avrc_api.h"
#include "avrc_int.h"
#include "wcassert.h"

/*****************************************************************************
**  Global data
@@ -805,8 +805,8 @@ static BT_HDR * avrc_pass_msg(tAVRC_MSG_PASS *p_msg)
    BT_HDR  *p_cmd = NULL;
    UINT8   *p_data;

    WC_ASSERT(p_msg != NULL);
    WC_ASSERT(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->pass_len));
    assert(p_msg != NULL);
    assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->pass_len));

    if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
    {
@@ -1084,7 +1084,7 @@ UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt)
UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
{
    BT_HDR *p_buf;
    WC_ASSERT(p_msg != NULL);
    assert(p_msg != NULL);
    if (p_msg)
    {
        p_msg->hdr.ctype    = AVRC_CMD_CTRL;
@@ -1123,7 +1123,7 @@ UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
UINT16 AVRC_PassRsp(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg)
{
    BT_HDR *p_buf;
    WC_ASSERT(p_msg != NULL);
    assert(p_msg != NULL);
    if (p_msg)
    {
        p_buf = avrc_pass_msg(p_msg);
+4 −6
Original line number Diff line number Diff line
@@ -21,15 +21,13 @@
 *  Interface to AVRCP optional commands
 *
 ******************************************************************************/
#include <assert.h>
#include <string.h>

#include "gki.h"
#include "avrc_api.h"
#include "avrc_int.h"

#include "wcassert.h"


/******************************************************************************
**
** Function         avrc_vendor_msg
@@ -51,13 +49,13 @@ static BT_HDR * avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg)
    BT_HDR  *p_cmd;
    UINT8   *p_data;

    WC_ASSERT(p_msg != NULL);
    assert(p_msg != NULL);

#if AVRC_METADATA_INCLUDED == TRUE
    WC_ASSERT(AVRC_META_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
    assert(AVRC_META_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
    if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_META_CMD_POOL_ID)) != NULL)
#else
    WC_ASSERT(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
    assert(AVRC_CMD_POOL_SIZE > (AVRC_MIN_CMD_LEN+p_msg->vendor_len));
    if ((p_cmd = (BT_HDR *) GKI_getpoolbuf(AVRC_CMD_POOL_ID)) != NULL)
#endif
    {

system/stack/include/wcassert.h

deleted100644 → 0
+0 −65
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright (C) 1999-2012 Broadcom Corporation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/
#ifndef WC_ASSERT_H
#define WC_ASSERT_H


#ifdef _DEBUG

#include "bt_target.h"



/* debug settings*/
#ifndef WC_DEBUG_LEVEL
#define WC_DEBUG_LEVEL 0
#endif

#if WC_DEBUG_LEVEL == 0

#include "stdio.h"  /* for printf()*/

#ifdef __cplusplus
extern "C" wc_assert(char *message, char *file, UINT32 line);
#else
void wc_assert(char *message, char *file, UINT32 line);
#endif

#define WC_ASSERT(_x) if ( !(_x) ) wc_assert("ASSERT at %s line %d\n", __FILE__, __LINE__);
#define WC_ASSERT_ALWAYS() wc_assert("ASSERT! at %s line %d\n", __FILE__, __LINE__);

#elif WC_DEBUG_LEVEL == 1

#include "assert.h"

#define WC_ASSERT(_x)        assert(_x);
#define WC_ASSERT_ALWAYS()   assert(0);
#endif  /* WC_DEBUG_LEVEL*/

#else /* _DEBUG*/

#ifndef WC_ASSERT
#define WC_ASSERT(_x)         ;
#endif

#ifndef WC_ASSERT_ALWAYS
#define WC_ASSERT_ALWAYS()    ;
#endif

#endif /* _DEBUG*/
#endif /* WC_ASSERT_H*/
+10 −10
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 *  Protocol (MCAP).
 *
 ******************************************************************************/
#include <assert.h>
#include <string.h>

#include "bt_target.h"
@@ -31,7 +32,6 @@
#include "mca_defs.h"
#include "mca_int.h"

#include "wcassert.h"
#include "btu.h"


@@ -125,8 +125,8 @@ tMCA_HANDLE MCA_Register(tMCA_REG *p_reg, tMCA_CTRL_CBACK *p_cback)
    tL2CAP_APPL_INFO l2c_cacp_appl;
    tL2CAP_APPL_INFO l2c_dacp_appl;

    WC_ASSERT(p_reg != NULL );
    WC_ASSERT(p_cback != NULL );
    assert(p_reg != NULL );
    assert(p_cback != NULL );

    MCA_TRACE_API ("MCA_Register: ctrl_psm:0x%x, data_psm:0x%x", p_reg->ctrl_psm, p_reg->data_psm);

@@ -221,9 +221,9 @@ tMCA_RESULT MCA_CreateDep(tMCA_HANDLE handle, tMCA_DEP *p_dep, tMCA_CS *p_cs)
    tMCA_RCB *p_rcb = mca_rcb_by_handle(handle);
    tMCA_CS  *p_depcs;

    WC_ASSERT(p_dep != NULL );
    WC_ASSERT(p_cs != NULL );
    WC_ASSERT(p_cs->p_data_cback != NULL );
    assert(p_dep != NULL );
    assert(p_cs != NULL );
    assert(p_cs->p_data_cback != NULL );

    MCA_TRACE_API ("MCA_CreateDep: %d", handle);
    if (p_rcb)
@@ -508,7 +508,7 @@ tMCA_RESULT MCA_CreateMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
    tMCA_DCB        *p_dcb;

    MCA_TRACE_API ("MCA_CreateMdlRsp: %d dep=%d mdl_id=%d cfg=%d rsp_code=%d", mcl, dep, mdl_id, cfg, rsp_code);
    WC_ASSERT(p_chnl_cfg != NULL );
    assert(p_chnl_cfg != NULL );
    if (p_ccb)
    {
        if (p_ccb->cong)
@@ -605,7 +605,7 @@ tMCA_RESULT MCA_ReconnectMdl(tMCA_CL mcl, tMCA_DEP dep, UINT16 data_psm,
    tMCA_DCB        *p_dcb;

    MCA_TRACE_API ("MCA_ReconnectMdl: %d ", mcl);
    WC_ASSERT(p_chnl_cfg != NULL );
    assert(p_chnl_cfg != NULL );
    if (p_ccb)
    {
        if (p_ccb->p_tx_req || p_ccb->p_rx_msg || p_ccb->cong)
@@ -674,7 +674,7 @@ tMCA_RESULT MCA_ReconnectMdlRsp(tMCA_CL mcl, tMCA_DEP dep,
    tMCA_DCB        *p_dcb;

    MCA_TRACE_API ("MCA_ReconnectMdlRsp: %d ", mcl);
    WC_ASSERT(p_chnl_cfg != NULL );
    assert(p_chnl_cfg != NULL );
    if (p_ccb)
    {
        if (p_ccb->cong)
@@ -739,7 +739,7 @@ tMCA_RESULT MCA_DataChnlCfg(tMCA_CL mcl, const tMCA_CHNL_CFG *p_chnl_cfg)
    tMCA_TC_TBL *p_tbl;

    MCA_TRACE_API ("MCA_DataChnlCfg: %d ", mcl);
    WC_ASSERT(p_chnl_cfg != NULL );
    assert(p_chnl_cfg != NULL );
    if (p_ccb)
    {
        result = MCA_NO_RESOURCES;
Loading