Просмотр исходного кода

Merge branch 'bugfix/bluedroid_warnings' into 'master'

bluedroid: fix warnings

Closes GCC-242

See merge request espressif/esp-idf!17872
Anton Maklakov 3 лет назад
Родитель
Сommit
cc2010682d

+ 7 - 0
components/bt/CMakeLists.txt

@@ -673,6 +673,13 @@ if(CONFIG_BT_ENABLED)
         target_link_libraries(${COMPONENT_LIB} PRIVATE nimblelib)
         target_link_libraries(${COMPONENT_LIB} PRIVATE nimblelib)
 
 
     endif()
     endif()
+
+    set_source_files_properties(
+        "host/bluedroid/bta/gatt/bta_gattc_act.c"
+        "host/bluedroid/bta/gatt/bta_gattc_cache.c"
+        "host/bluedroid/btc/profile/std/gatt/btc_gatt_util.c"
+        "host/bluedroid/btc/profile/std/gatt/btc_gatts.c"
+        PROPERTIES COMPILE_FLAGS -Wno-address-of-packed-member)
 endif()
 endif()
 
 
 if(CONFIG_BT_NIMBLE_MESH)
 if(CONFIG_BT_NIMBLE_MESH)

+ 1 - 1
components/bt/esp_ble_mesh/mesh_core/crypto.h

@@ -77,7 +77,7 @@ static inline int bt_mesh_beacon_key(const uint8_t net_key[16],
 }
 }
 
 
 int bt_mesh_beacon_auth(const uint8_t beacon_key[16], uint8_t flags,
 int bt_mesh_beacon_auth(const uint8_t beacon_key[16], uint8_t flags,
-                        const uint8_t net_id[16], uint32_t iv_index,
+                        const uint8_t net_id[8], uint32_t iv_index,
                         uint8_t auth[8]);
                         uint8_t auth[8]);
 
 
 static inline int bt_mesh_app_id(const uint8_t app_key[16], uint8_t app_id[1])
 static inline int bt_mesh_app_id(const uint8_t app_key[16], uint8_t app_id[1])

+ 3 - 3
components/bt/host/bluedroid/bta/dm/bta_dm_act.c

@@ -66,7 +66,7 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
 static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, LINK_KEY key, UINT8 key_type, BOOLEAN sc_support);
 static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, LINK_KEY key, UINT8 key_type, BOOLEAN sc_support);
 static UINT8 bta_dm_authentication_complete_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, int result);
 static UINT8 bta_dm_authentication_complete_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, int result);
 #endif  ///SMP_INCLUDED == TRUE
 #endif  ///SMP_INCLUDED == TRUE
-static void bta_dm_local_name_cback(BD_ADDR bd_addr);
+static void bta_dm_local_name_cback(const BD_ADDR bd_addr);
 static BOOLEAN bta_dm_check_av(UINT16 event);
 static BOOLEAN bta_dm_check_av(UINT16 event);
 static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data);
 static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data);
 
 
@@ -3265,10 +3265,10 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
 ** Returns          void
 ** Returns          void
 **
 **
 *******************************************************************************/
 *******************************************************************************/
-static void bta_dm_local_name_cback(UINT8 *p_name)
+static void bta_dm_local_name_cback(const BD_ADDR bd_addr)
 {
 {
     tBTA_DM_SEC sec_event;
     tBTA_DM_SEC sec_event;
-    UNUSED(p_name);
+    UNUSED(bd_addr);
 
 
     sec_event.enable.status = BTA_SUCCESS;
     sec_event.enable.status = BTA_SUCCESS;
 
 

+ 1 - 1
components/bt/host/bluedroid/bta/hf_ag/bta_ag_cmd.c

@@ -612,7 +612,7 @@ static UINT8 bta_ag_parse_chld(tBTA_AG_SCB *p_scb, char *p_s)
     INT16   idx = -1;
     INT16   idx = -1;
     UNUSED(p_scb);
     UNUSED(p_scb);
 
 
-    if (!isdigit(p_s[0])) {
+    if (!isdigit((unsigned char)p_s[0])) {
         return BTA_AG_INVALID_CHLD;
         return BTA_AG_INVALID_CHLD;
     }
     }
 
 

+ 1 - 1
components/bt/host/bluedroid/stack/btm/btm_acl.c

@@ -237,7 +237,7 @@ BOOLEAN btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR conn_ad
 ** Returns          void
 ** Returns          void
 **
 **
 *******************************************************************************/
 *******************************************************************************/
-void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
+void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_LEN],
                       UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport)
                       UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport)
 {
 {
     tBTM_SEC_DEV_REC *p_dev_rec = NULL;
     tBTM_SEC_DEV_REC *p_dev_rec = NULL;

+ 1 - 1
components/bt/host/bluedroid/stack/btm/btm_ble.c

@@ -1557,7 +1557,7 @@ void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
 {
 {
     tBTM_CB *p_cb = &btm_cb;
     tBTM_CB *p_cb = &btm_cb;
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
     tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
-    BT_OCTET8 dummy_stk = {0};
+    BT_OCTET16 dummy_stk = {0};
 
 
     BTM_TRACE_DEBUG ("btm_ble_ltk_request");
     BTM_TRACE_DEBUG ("btm_ble_ltk_request");
 
 

+ 1 - 1
components/bt/host/bluedroid/stack/btm/btm_devctl.c

@@ -266,7 +266,7 @@ void btm_dev_timeout (TIMER_LIST_ENT  *p_tle)
 ** Returns          void
 ** Returns          void
 **
 **
 *******************************************************************************/
 *******************************************************************************/
-static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_features)
+static void btm_decode_ext_features_page (UINT8 page_number, const BD_FEATURES p_features)
 {
 {
     BTM_TRACE_DEBUG ("btm_decode_ext_features_page page: %d", page_number);
     BTM_TRACE_DEBUG ("btm_decode_ext_features_page page: %d", page_number);
     switch (page_number) {
     switch (page_number) {

+ 1 - 1
components/bt/host/bluedroid/stack/btm/include/btm_int.h

@@ -1023,7 +1023,7 @@ BOOLEAN btm_lookup_eir(BD_ADDR_PTR p_rem_addr);
 */
 */
 void         btm_acl_free(void);
 void         btm_acl_free(void);
 void         btm_acl_init (void);
 void         btm_acl_init (void);
-void         btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
+void         btm_acl_created (BD_ADDR bda, DEV_CLASS dc, UINT8 bdn[BTM_MAX_REM_BD_NAME_LEN],
                               UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport);
                               UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport);
 void         btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport);
 void         btm_acl_removed (BD_ADDR bda, tBT_TRANSPORT transport);
 void         btm_acl_device_down (void);
 void         btm_acl_device_down (void);

+ 1 - 1
components/bt/host/bluedroid/stack/hcic/hcicmds.c

@@ -1054,7 +1054,7 @@ BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag)
     return (TRUE);
     return (TRUE);
 }
 }
 
 
-BOOLEAN btsnd_hcic_change_name (BD_NAME name)
+BOOLEAN btsnd_hcic_change_name (const UINT8 *name)
 {
 {
     BT_HDR *p;
     BT_HDR *p;
     UINT8 *pp;
     UINT8 *pp;

+ 1 - 1
components/bt/host/bluedroid/stack/include/stack/hcimsgs.h

@@ -498,7 +498,7 @@ BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
 /* Delete Stored Key */
 /* Delete Stored Key */
 
 
 /* Change Local Name */
 /* Change Local Name */
-BOOLEAN btsnd_hcic_change_name(BD_NAME name);
+BOOLEAN btsnd_hcic_change_name (const UINT8 *name);
 
 
 #define HCIC_PARAM_SIZE_CHANGE_NAME     BD_NAME_LEN
 #define HCIC_PARAM_SIZE_CHANGE_NAME     BD_NAME_LEN
 
 

+ 16 - 0
examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/main/main.c

@@ -159,9 +159,15 @@ static void example_change_led_state(uint8_t onoff)
     /* When the node receives the first Generic OnOff Get/Set/Set Unack message, it will
     /* When the node receives the first Generic OnOff Get/Set/Set Unack message, it will
      * start the timer used to disable fast provisioning functionality.
      * start the timer used to disable fast provisioning functionality.
      */
      */
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
     if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
     if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
     }
     }
+#pragma GCC diagnostic pop
+
 }
 }
 
 
 static void node_prov_complete(uint16_t net_idx, uint16_t addr, uint8_t flags, uint32_t iv_index)
 static void node_prov_complete(uint16_t net_idx, uint16_t addr, uint8_t flags, uint32_t iv_index)
@@ -231,12 +237,17 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
         }
         }
         if (fast_prov_server.node_addr_cnt != FAST_PROV_NODE_COUNT_MIN &&
         if (fast_prov_server.node_addr_cnt != FAST_PROV_NODE_COUNT_MIN &&
             fast_prov_server.node_addr_cnt <= fast_prov_server.max_node_num) {
             fast_prov_server.node_addr_cnt <= fast_prov_server.max_node_num) {
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
             if (bt_mesh_atomic_test_and_clear_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
             if (bt_mesh_atomic_test_and_clear_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
                 k_delayed_work_cancel(&fast_prov_server.gatt_proxy_enable_timer);
                 k_delayed_work_cancel(&fast_prov_server.gatt_proxy_enable_timer);
             }
             }
             if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
             if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
                 k_delayed_work_submit(&fast_prov_server.gatt_proxy_enable_timer, GATT_PROXY_ENABLE_TIMEOUT);
                 k_delayed_work_submit(&fast_prov_server.gatt_proxy_enable_timer, GATT_PROXY_ENABLE_TIMEOUT);
             }
             }
+#pragma GCC diagnostic pop
         }
         }
     } else {
     } else {
         /* When a device is provisioned, the non-primary Provisioner shall reset the timer
         /* When a device is provisioned, the non-primary Provisioner shall reset the timer
@@ -250,6 +261,10 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
         }
         }
     }
     }
 
 
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
     if (bt_mesh_atomic_test_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
     if (bt_mesh_atomic_test_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
         /* When a device is provisioned, and the stop_prov flag of the Provisioner has been
         /* When a device is provisioned, and the stop_prov flag of the Provisioner has been
          * set, the Provisioner shall reset the timer which is used to stop the provisioner
          * set, the Provisioner shall reset the timer which is used to stop the provisioner
@@ -258,6 +273,7 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
         k_delayed_work_cancel(&fast_prov_server.disable_fast_prov_timer);
         k_delayed_work_cancel(&fast_prov_server.disable_fast_prov_timer);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
     }
     }
+#pragma GCC diagnostic pop
 
 
     /* The Provisioner will send Config AppKey Add to the node. */
     /* The Provisioner will send Config AppKey Add to the node. */
     example_msg_common_info_t info = {
     example_msg_common_info_t info = {

+ 15 - 0
examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/main.c

@@ -171,9 +171,14 @@ static void example_change_led_state(uint8_t onoff)
     /* When the node receives the first Generic OnOff Get/Set/Set Unack message, it will
     /* When the node receives the first Generic OnOff Get/Set/Set Unack message, it will
      * start the timer used to disable fast provisioning functionality.
      * start the timer used to disable fast provisioning functionality.
      */
      */
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
     if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
     if (!bt_mesh_atomic_test_and_set_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
     }
     }
+#pragma GCC diagnostic pop
 }
 }
 
 
 static void node_prov_complete(uint16_t net_idx, uint16_t addr, uint8_t flags, uint32_t iv_index)
 static void node_prov_complete(uint16_t net_idx, uint16_t addr, uint8_t flags, uint32_t iv_index)
@@ -241,6 +246,10 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
             ESP_LOGE(TAG, "%s: Failed to store node address 0x%04x", __func__, unicast_addr);
             ESP_LOGE(TAG, "%s: Failed to store node address 0x%04x", __func__, unicast_addr);
             return;
             return;
         }
         }
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
         if (fast_prov_server.node_addr_cnt != FAST_PROV_NODE_COUNT_MIN &&
         if (fast_prov_server.node_addr_cnt != FAST_PROV_NODE_COUNT_MIN &&
                 fast_prov_server.node_addr_cnt <= fast_prov_server.max_node_num) {
                 fast_prov_server.node_addr_cnt <= fast_prov_server.max_node_num) {
             if (bt_mesh_atomic_test_and_clear_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
             if (bt_mesh_atomic_test_and_clear_bit(fast_prov_server.srv_flags, GATT_PROXY_ENABLE_START)) {
@@ -250,6 +259,7 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
                 k_delayed_work_submit(&fast_prov_server.gatt_proxy_enable_timer, GATT_PROXY_ENABLE_TIMEOUT);
                 k_delayed_work_submit(&fast_prov_server.gatt_proxy_enable_timer, GATT_PROXY_ENABLE_TIMEOUT);
             }
             }
         }
         }
+#pragma GCC diagnostic pop
     } else {
     } else {
         /* When a device is provisioned, the non-primary Provisioner shall reset the timer
         /* When a device is provisioned, the non-primary Provisioner shall reset the timer
          * which is used to send node addresses to the primary Provisioner.
          * which is used to send node addresses to the primary Provisioner.
@@ -262,6 +272,10 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
         }
         }
     }
     }
 
 
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
     if (bt_mesh_atomic_test_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
     if (bt_mesh_atomic_test_bit(fast_prov_server.srv_flags, DISABLE_FAST_PROV_START)) {
         /* When a device is provisioned, and the stop_prov flag of the Provisioner has been
         /* When a device is provisioned, and the stop_prov flag of the Provisioner has been
          * set, the Provisioner shall reset the timer which is used to stop the provisioner
          * set, the Provisioner shall reset the timer which is used to stop the provisioner
@@ -270,6 +284,7 @@ static void provisioner_prov_complete(int node_idx, const uint8_t uuid[16], uint
         k_delayed_work_cancel(&fast_prov_server.disable_fast_prov_timer);
         k_delayed_work_cancel(&fast_prov_server.disable_fast_prov_timer);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
         k_delayed_work_submit(&fast_prov_server.disable_fast_prov_timer, DISABLE_FAST_PROV_TIMEOUT);
     }
     }
+#pragma GCC diagnostic pop
 
 
     /* The Provisioner will send Config AppKey Add to the node. */
     /* The Provisioner will send Config AppKey Add to the node. */
     example_msg_common_info_t info = {
     example_msg_common_info_t info = {

+ 4 - 0
examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/CMakeLists.txt

@@ -5,3 +5,7 @@ set(srcs "ble_mesh_fast_prov_client_model.c"
 idf_component_register(SRCS "${srcs}"
 idf_component_register(SRCS "${srcs}"
                     INCLUDE_DIRS  "."
                     INCLUDE_DIRS  "."
                     REQUIRES bt)
                     REQUIRES bt)
+
+set_source_files_properties(
+    "ble_mesh_fast_prov_server_model.c"
+    PROPERTIES COMPILE_FLAGS -Wno-address-of-packed-member)