Skip to content

Commit 43c3946

Browse files
jhedbergPavelVPV
authored andcommitted
[nrf fromtree] Bluetooth: Host: Fix build error with observer-only config
When building an observer-only build the check_pending_conn label would result in CI warnings/errors due to this only being a C23 feature: scan.c:692:1: error: label at end of compound statement is a C23 extension Turns out the #ifdefs are completely unnecessary, and the code can simply take advantage of IS_ENABLED(), which should get rid of the warning. Signed-off-by: Johan Hedberg <[email protected]> (cherry picked from commit 73b6f8b) Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent 9b49944 commit 43c3946

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

subsys/bluetooth/host/scan.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ int bt_le_scan_user_remove(enum bt_le_scan_user flag)
538538
return scan_update();
539539
}
540540

541-
#if defined(CONFIG_BT_CENTRAL)
542541
static void check_pending_conn(const bt_addr_le_t *id_addr,
543542
const bt_addr_le_t *addr, uint8_t adv_props)
544543
{
@@ -593,7 +592,6 @@ static void check_pending_conn(const bt_addr_le_t *id_addr,
593592
LOG_WRN("Error while updating the scanner (%d)", err);
594593
}
595594
}
596-
#endif /* CONFIG_BT_CENTRAL */
597595

598596
/* Convert Legacy adv report evt_type field to adv props */
599597
static uint8_t get_adv_props_legacy(uint8_t evt_type)
@@ -656,7 +654,7 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info,
656654
/* For connection-purpose scanning,
657655
* skip app callbacks but allow pending-conn check logic.
658656
*/
659-
if (!explicit_scan && conn_scan) {
657+
if (IS_ENABLED(CONFIG_BT_CENTRAL) && !explicit_scan && conn_scan) {
660658
goto check_pending_conn;
661659
}
662660

@@ -686,9 +684,9 @@ static void le_adv_recv(bt_addr_le_t *addr, struct bt_le_scan_recv_info *info,
686684
info->addr = NULL;
687685

688686
check_pending_conn:
689-
#if defined(CONFIG_BT_CENTRAL)
690-
check_pending_conn(&id_addr, addr, info->adv_props);
691-
#endif /* CONFIG_BT_CENTRAL */
687+
if (IS_ENABLED(CONFIG_BT_CENTRAL)) {
688+
check_pending_conn(&id_addr, addr, info->adv_props);
689+
}
692690
}
693691

694692
#if defined(CONFIG_BT_EXT_ADV)

0 commit comments

Comments
 (0)