Skip to content

Commit

Permalink
pkg/nimble: fix compilation with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed May 20, 2023
1 parent 6d4bcbe commit f1e126b
Showing 1 changed file with 256 additions and 0 deletions.
256 changes: 256 additions & 0 deletions pkg/nimble/patches/0001-treewide-fix-compilation-with-clang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
From 7c9c9649154f271534b6def3f72d6ba0be079aac Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Sat, 20 May 2023 21:27:57 +0200
Subject: [PATCH] treewide: fix compilation with clang

---
nimble/controller/src/ble_ll_adv.c | 1 +
nimble/controller/src/ble_ll_conn.c | 1 +
nimble/controller/src/ble_ll_scan.c | 3 +++
nimble/controller/src/ble_ll_scan_aux.c | 3 +++
nimble/drivers/nrf52/src/ble_phy.c | 1 +
nimble/host/services/ipss/src/ble_svc_ipss.c | 2 ++
nimble/host/src/ble_att_clt.c | 1 +
nimble/host/src/ble_gap.c | 2 +-
nimble/host/src/ble_hs.c | 2 ++
nimble/host/src/ble_hs_conn.c | 2 ++
nimble/host/src/ble_l2cap.c | 1 +
nimble/transport/src/transport.c | 5 +++++
porting/nimble/src/os_msys_init.c | 4 +++-
13 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index 3327ba5..1fdb439 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -1512,6 +1512,7 @@ ble_ll_adv_aux_schedule_next(struct ble_ll_adv_sm *advsm)
BLE_LL_ASSERT(AUX_DATA_LEN(advsm) >= next_aux_data_offset);

rem_aux_data_len = AUX_DATA_LEN(advsm) - next_aux_data_offset;
+ (void)rem_aux_data_len;
BLE_LL_ASSERT(rem_aux_data_len > 0);

ble_ll_adv_aux_calculate(advsm, aux_next, next_aux_data_offset);
diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c
index b666019..7b60e03 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -4327,6 +4327,7 @@ ble_ll_conn_module_init(void)
STATS_SIZE_INIT_PARMS(ble_ll_conn_stats, STATS_SIZE_32),
STATS_NAME_INIT_PARMS(ble_ll_conn_stats),
"ble_ll_conn");
+ (void)rc;
BLE_LL_ASSERT(rc == 0);

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_CTRL_TO_HOST_FLOW_CONTROL)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index d9d3517..ad2d721 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -630,6 +630,7 @@ ble_ll_scan_dup_update_legacy(uint8_t addr_type, const uint8_t *addr,
*/

e = TAILQ_FIRST(&g_scan_dup_list);
+ (void)type;
BLE_LL_ASSERT(e && e->type == type && !memcmp(e->addr, addr, 6));

if (subev == BLE_HCI_LE_SUBEV_DIRECT_ADV_RPT) {
@@ -1866,6 +1867,7 @@ ble_ll_scan_dup_update_ext(uint8_t addr_type, uint8_t *addr, bool has_aux,
*/

e = TAILQ_FIRST(&g_scan_dup_list);
+ (void)type;
BLE_LL_ASSERT(e && e->type == type && (is_anon || !memcmp(e->addr, addr, 6)));

e->flags |= BLE_LL_SCAN_DUP_F_ADV_REPORT_SENT;
@@ -2722,6 +2724,7 @@ ble_ll_scan_init(void)
sizeof(struct ble_ll_scan_dup_entry),
g_scan_dup_mem,
"ble_ll_scan_dup_pool");
+ (void)err;
BLE_LL_ASSERT(err == 0);

TAILQ_INIT(&g_scan_dup_list);
diff --git a/nimble/controller/src/ble_ll_scan_aux.c b/nimble/controller/src/ble_ll_scan_aux.c
index 2eb915d..51f1bd5 100644
--- a/nimble/controller/src/ble_ll_scan_aux.c
+++ b/nimble/controller/src/ble_ll_scan_aux.c
@@ -118,9 +118,11 @@ ble_ll_scan_aux_sched_cb(struct ble_ll_sched_item *sch)
BLE_LL_ASSERT(aux);

lls = ble_ll_state_get();
+ (void)lls;
BLE_LL_ASSERT(lls == BLE_LL_STATE_STANDBY);

rc = ble_phy_setchan(aux->chan, BLE_ACCESS_ADDR_ADV, BLE_LL_CRCINIT_ADV);
+ (void)rc;
BLE_LL_ASSERT(rc == 0);

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
@@ -1757,6 +1759,7 @@ ble_ll_scan_aux_init(void)
MYNEWT_VAL(BLE_LL_SCAN_AUX_SEGMENT_CNT),
sizeof(struct ble_ll_scan_aux_data),
aux_data_mem, "ble_ll_scan_aux_data_pool");
+ (void)err;
BLE_LL_ASSERT(err == 0);
}

diff --git a/nimble/drivers/nrf52/src/ble_phy.c b/nimble/drivers/nrf52/src/ble_phy.c
index 9b44123..5ac541b 100644
--- a/nimble/drivers/nrf52/src/ble_phy.c
+++ b/nimble/drivers/nrf52/src/ble_phy.c
@@ -1625,6 +1625,7 @@ ble_phy_init(void)
STATS_SIZE_32),
STATS_NAME_INIT_PARMS(ble_phy_stats),
"ble_phy");
+ (void)rc;
assert(rc == 0);

g_ble_phy_data.phy_stats_initialized = 1;
diff --git a/nimble/host/services/ipss/src/ble_svc_ipss.c b/nimble/host/services/ipss/src/ble_svc_ipss.c
index f42ca1e..82f4a41 100644
--- a/nimble/host/services/ipss/src/ble_svc_ipss.c
+++ b/nimble/host/services/ipss/src/ble_svc_ipss.c
@@ -44,8 +44,10 @@ ble_svc_ipss_init(void)
SYSINIT_ASSERT_ACTIVE();

rc = ble_gatts_count_cfg(ble_svc_ipss_defs);
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = ble_gatts_add_svcs(ble_svc_ipss_defs);
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);
}
diff --git a/nimble/host/src/ble_att_clt.c b/nimble/host/src/ble_att_clt.c
index a36cf3a..52586cb 100644
--- a/nimble/host/src/ble_att_clt.c
+++ b/nimble/host/src/ble_att_clt.c
@@ -717,6 +717,7 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle, uint16_t handle,
BLE_HS_LOG(DEBUG, ":");
}
rc = os_mbuf_copydata(txom, i, 1, &b);
+ (void)rc;
assert(rc == 0);
BLE_HS_LOG(DEBUG, "0x%02x", b);
}
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 113a972..fb171e4 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -3354,7 +3354,7 @@ ble_gap_ext_adv_clear(void)
/* If there is an active instance or periodic adv instance,
* Don't send the command
* */
- if ((ble_gap_slave[instance].op == BLE_GAP_OP_S_ADV)) {
+ if (ble_gap_slave[instance].op == BLE_GAP_OP_S_ADV) {
ble_hs_unlock();
return BLE_HS_EBUSY;
}
diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index 13b6fe2..3dc2551 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -544,6 +544,7 @@ ble_hs_event_start_stage2(struct ble_npl_event *ev)
int rc;

rc = ble_hs_start();
+ (void)rc;
assert(rc == 0);
}

@@ -722,6 +723,7 @@ ble_hs_init(void)
ble_hs_hci_init();

rc = ble_hs_conn_init();
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

#if MYNEWT_VAL(BLE_PERIODIC_ADV)
diff --git a/nimble/host/src/ble_hs_conn.c b/nimble/host/src/ble_hs_conn.c
index ea89460..4fabbea 100644
--- a/nimble/host/src/ble_hs_conn.c
+++ b/nimble/host/src/ble_hs_conn.c
@@ -426,10 +426,12 @@ ble_hs_conn_addrs(const struct ble_hs_conn *conn,
our_id_addr_val = conn->bhc_our_rnd_addr;
} else {
rc = ble_hs_id_addr(addrs->our_id_addr.type, &our_id_addr_val, NULL);
+ (void)rc;
assert(rc == 0);
}
#else
rc = ble_hs_id_addr(addrs->our_id_addr.type, &our_id_addr_val, NULL);
+ (void)rc;
assert(rc == 0);
#endif

diff --git a/nimble/host/src/ble_l2cap.c b/nimble/host/src/ble_l2cap.c
index 810d07b..55deb7b 100644
--- a/nimble/host/src/ble_l2cap.c
+++ b/nimble/host/src/ble_l2cap.c
@@ -250,6 +250,7 @@ ble_l2cap_append_rx(struct ble_l2cap_chan *chan, struct os_mbuf *frag)

/* Copy the data from the incoming fragment into the packet in progress. */
m = os_mbuf_pack_chains(chan->rx_buf, frag);
+ (void)m;
assert(m);
#else
/* Join disabled or append failed due to mbuf shortage. Just attach the
diff --git a/nimble/transport/src/transport.c b/nimble/transport/src/transport.c
index 0a641a8..1b6bc90 100644
--- a/nimble/transport/src/transport.c
+++ b/nimble/transport/src/transport.c
@@ -190,22 +190,27 @@ ble_transport_init(void)

rc = os_mempool_init(&pool_cmd, POOL_CMD_COUNT, POOL_CMD_SIZE,
pool_cmd_buf, "transport_pool_cmd");
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = os_mempool_init(&pool_evt, POOL_EVT_COUNT, POOL_EVT_SIZE,
pool_evt_buf, "transport_pool_evt");
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = os_mempool_init(&pool_evt_lo, POOL_EVT_LO_COUNT, POOL_EVT_SIZE,
pool_evt_lo_buf, "transport_pool_evt_lo");
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = os_mempool_ext_init(&pool_acl, POOL_ACL_COUNT, POOL_ACL_SIZE,
pool_acl_buf, "transport_pool_acl");
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = os_mbuf_pool_init(&mpool_acl, &pool_acl.mpe_mp,
POOL_ACL_SIZE, POOL_ACL_COUNT);
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

pool_acl.mpe_put_cb = ble_transport_acl_put;
diff --git a/porting/nimble/src/os_msys_init.c b/porting/nimble/src/os_msys_init.c
index d22ae35..21f76a3 100644
--- a/porting/nimble/src/os_msys_init.c
+++ b/porting/nimble/src/os_msys_init.c
@@ -112,9 +112,11 @@ os_msys_init_once(void *data, struct os_mempool *mempool,

rc = mem_init_mbuf_pool(data, mempool, mbuf_pool, block_count, block_size,
name);
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);

rc = os_msys_register(mbuf_pool);
+ (void)rc;
SYSINIT_PANIC_ASSERT(rc == 0);
}

@@ -153,4 +155,4 @@ os_msys_init(void)
rc = os_sanity_check_register(&os_msys_sc);
SYSINIT_PANIC_ASSERT(rc == 0);
#endif
-}
\ No newline at end of file
+}
--
2.40.1

0 comments on commit f1e126b

Please sign in to comment.