This patch set fixes some clang compile errors and warnings. These do
not cover errors that are produced when BlueZ for Android is compiled
using clang (i.e. passing --disable-android to ./bootstrap-configure).
Arman Uguray (4):
plugins/policy: Fix clang compile error
tools/smp-tester: Remove unused variable.
tools/mgmt-tester: Remove unused set_adv_data_2
tools/gatt-service: Fix clang compile error
plugins/policy.c | 8 ++++----
tools/gatt-service.c | 4 +---
tools/mgmt-tester.c | 46 +++++++++++++++++++---------------------------
tools/smp-tester.c | 9 ---------
4 files changed, 24 insertions(+), 43 deletions(-)
--
2.2.0.rc0.207.ga3a616c
Hi Arman,
On Tue, May 5, 2015 at 2:28 AM, Arman Uguray <[email protected]> wrote:
> This patch set fixes some clang compile errors and warnings. These do
> not cover errors that are produced when BlueZ for Android is compiled
> using clang (i.e. passing --disable-android to ./bootstrap-configure).
>
> Arman Uguray (4):
> plugins/policy: Fix clang compile error
> tools/smp-tester: Remove unused variable.
> tools/mgmt-tester: Remove unused set_adv_data_2
> tools/gatt-service: Fix clang compile error
>
> plugins/policy.c | 8 ++++----
> tools/gatt-service.c | 4 +---
> tools/mgmt-tester.c | 46 +++++++++++++++++++---------------------------
> tools/smp-tester.c | 9 ---------
> 4 files changed, 24 insertions(+), 43 deletions(-)
>
> --
> 2.2.0.rc0.207.ga3a616c
Applied, thanks.
--
Luiz Augusto von Dentz
This patch removes the unused variable "set_adv_data_2" from
tools/mgmt-tester.c. The remaining set_adv_data_* variables have also
been renamed to keep the numbering sequential.
---
tools/mgmt-tester.c | 46 +++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index c0f58ce..fab8d35 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -1865,7 +1865,6 @@ static const char stop_discovery_valid_hci[] = { 0x00, 0x00 };
static const char stop_discovery_evt[] = { 0x07, 0x00 };
static const char stop_discovery_bredr_param[] = { 0x01 };
static const char stop_discovery_bredr_discovering[] = { 0x01, 0x00 };
-static const char stop_discovery_inq_param[] = { 0x33, 0x8b, 0x9e, 0x08, 0x00 };
static const struct generic_data stop_discovery_success_test_1 = {
.setup_settings = settings_powered_le,
@@ -3946,48 +3945,41 @@ static const uint8_t set_adv_data_1[] = {
};
static const uint8_t set_adv_data_2[] = {
- 0x0c, 0x02, 0x01, 0x04, 0x03, 0x03, 0x0d, 0x18, 0x04, 0xff,
- 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-
-static const uint8_t set_adv_data_3[] = {
0x06, 0x05, 0x08, 0x74, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
-static const uint8_t set_adv_data_4[] = {
+static const uint8_t set_adv_data_3[] = {
0x03, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
-static const uint8_t set_adv_data_5[] = {
+static const uint8_t set_adv_data_4[] = {
0x0c, 0x02, 0x01, 0x02, 0x03, 0x02, 0x0d, 0x18, 0x04, 0xff,
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
-static const uint8_t set_adv_data_6[] = {
+static const uint8_t set_adv_data_5[] = {
0x0c, 0x02, 0x01, 0x01, 0x03, 0x02, 0x0d, 0x18, 0x04, 0xff,
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
-static const uint8_t set_adv_data_7[] = {
+static const uint8_t set_adv_data_6[] = {
0x0c, 0x02, 0x01, 0x02, 0x03, 0x02, 0x0d, 0x18, 0x04, 0xff,
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
-static const uint8_t set_adv_data_8[] = {
+static const uint8_t set_adv_data_7[] = {
0x0c, 0x03, 0x02, 0x0d, 0x18, 0x04, 0xff, 0x01, 0x02, 0x03,
0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -4193,8 +4185,8 @@ static const struct generic_data add_advertising_success_2 = {
.expect_param = set_powered_adv_instance_settings_param,
.expect_len = sizeof(set_powered_adv_instance_settings_param),
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_3,
- .expect_hci_len = sizeof(set_adv_data_3),
+ .expect_hci_param = set_adv_data_2,
+ .expect_hci_len = sizeof(set_adv_data_2),
};
static const struct generic_data add_advertising_success_3 = {
@@ -4217,8 +4209,8 @@ static const struct generic_data add_advertising_success_4 = {
.expect_param = set_adv_settings_param_2,
.expect_len = sizeof(set_adv_settings_param_2),
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_4,
- .expect_hci_len = sizeof(set_adv_data_4),
+ .expect_hci_param = set_adv_data_3,
+ .expect_hci_len = sizeof(set_adv_data_3),
};
static const char set_adv_off_param[] = { 0x00 };
@@ -4231,8 +4223,8 @@ static const struct generic_data add_advertising_success_5 = {
.expect_param = set_powered_adv_instance_settings_param,
.expect_len = sizeof(set_powered_adv_instance_settings_param),
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_3,
- .expect_hci_len = sizeof(set_adv_data_3),
+ .expect_hci_param = set_adv_data_2,
+ .expect_hci_len = sizeof(set_adv_data_2),
};
static const struct generic_data add_advertising_success_6 = {
@@ -4289,8 +4281,8 @@ static const struct generic_data add_advertising_success_9 = {
.expect_len = sizeof(advertising_instance_param),
.expect_status = MGMT_STATUS_SUCCESS,
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_5,
- .expect_hci_len = sizeof(set_adv_data_5),
+ .expect_hci_param = set_adv_data_4,
+ .expect_hci_len = sizeof(set_adv_data_4),
};
static const struct generic_data add_advertising_success_10 = {
@@ -4302,8 +4294,8 @@ static const struct generic_data add_advertising_success_10 = {
.expect_len = sizeof(advertising_instance_param),
.expect_status = MGMT_STATUS_SUCCESS,
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_6,
- .expect_hci_len = sizeof(set_adv_data_6),
+ .expect_hci_param = set_adv_data_5,
+ .expect_hci_len = sizeof(set_adv_data_5),
};
static const struct generic_data add_advertising_success_11 = {
@@ -4315,8 +4307,8 @@ static const struct generic_data add_advertising_success_11 = {
.expect_len = sizeof(advertising_instance_param),
.expect_status = MGMT_STATUS_SUCCESS,
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_7,
- .expect_hci_len = sizeof(set_adv_data_7),
+ .expect_hci_param = set_adv_data_6,
+ .expect_hci_len = sizeof(set_adv_data_6),
};
static const struct generic_data add_advertising_success_12 = {
@@ -4328,8 +4320,8 @@ static const struct generic_data add_advertising_success_12 = {
.expect_len = sizeof(advertising_instance_param),
.expect_status = MGMT_STATUS_SUCCESS,
.expect_hci_command = BT_HCI_CMD_LE_SET_ADV_DATA,
- .expect_hci_param = set_adv_data_8,
- .expect_hci_len = sizeof(set_adv_data_8),
+ .expect_hci_param = set_adv_data_7,
+ .expect_hci_len = sizeof(set_adv_data_7),
};
static uint16_t settings_powered_le_connectable[] = {
--
2.2.0.rc0.207.ga3a616c
This patch fixes the following compile warning when bluez is compiled
using clang:
tools/gatt-service.c:77:19: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
static const char const *ias_alert_level_props[] = {
^
---
tools/gatt-service.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/gatt-service.c b/tools/gatt-service.c
index 33e0d6a..9baa9e1 100644
--- a/tools/gatt-service.c
+++ b/tools/gatt-service.c
@@ -74,9 +74,7 @@ struct descriptor {
* properties are defined at doc/gatt-api.txt. See "Flags"
* property of the GattCharacteristic1.
*/
-static const char const *ias_alert_level_props[] = {
- "write-without-response",
- NULL };
+static const char *ias_alert_level_props[] = { "write-without-response", NULL };
static gboolean desc_get_uuid(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *user_data)
--
2.2.0.rc0.207.ga3a616c
This patch removes three unused variables from tools/smp-tester.c.
---
tools/smp-tester.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/tools/smp-tester.c b/tools/smp-tester.c
index ab77b24..c44dc2d 100644
--- a/tools/smp-tester.c
+++ b/tools/smp-tester.c
@@ -326,13 +326,6 @@ static const struct smp_data smp_server_nval_req_3_test = {
.req_count = G_N_ELEMENTS(srv_nval_req_2),
};
-static const uint8_t smp_nval_req_4[] = { 0xff, 0xff };
-static const uint8_t smp_nval_req_4_rsp[] = { 0x05, 0x07 };
-
-static const struct smp_req_rsp srv_nval_req_3[] = {
- { smp_nval_req_4, sizeof(smp_nval_req_4), NULL, 0 },
-};
-
static const uint8_t smp_basic_req_1[] = { 0x01, /* Pairing Request */
0x03, /* NoInputNoOutput */
0x00, /* OOB Flag */
@@ -455,8 +448,6 @@ static const uint8_t smp_sc_rsp_1[] = { 0x02, /* Pairing Response */
static const uint8_t smp_sc_pk[65] = { 0x0c };
-static const uint8_t smp_sc_failed_rsp_1[] = { 0x05, 0x08 };
-
static const struct smp_req_rsp cli_sc_req_2[] = {
{ NULL, 0, smp_sc_req_1, sizeof(smp_sc_req_1) },
{ smp_sc_rsp_1, sizeof(smp_sc_rsp_1), smp_sc_pk, sizeof(smp_sc_pk) },
--
2.2.0.rc0.207.ga3a616c
This patch fixes the following error when bluez is compiled with clang:
plugins/policy.c:780:6: error: cast from 'int *' to 'size_t *' (aka 'unsigned long *') increases required alignment from 4 to 8 [-Werror,-Wcast-align]
(size_t *) &reconnect_intervals_len,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
plugins/policy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/policy.c b/plugins/policy.c
index 8098689..7687203 100644
--- a/plugins/policy.c
+++ b/plugins/policy.c
@@ -61,19 +61,19 @@ struct reconnect_data {
GSList *services;
guint timer;
bool active;
- int attempt;
+ unsigned int attempt;
};
static const char *default_reconnect[] = {
HSP_AG_UUID, HFP_AG_UUID, A2DP_SOURCE_UUID, NULL };
static char **reconnect_uuids = NULL;
-static const int default_attempts = 7;
-static int reconnect_attempts = 0;
+static const size_t default_attempts = 7;
+static size_t reconnect_attempts = 0;
static const int default_intervals[] = { 1, 2, 4, 8, 16, 32, 64 };
static int *reconnect_intervals = NULL;
-static int reconnect_intervals_len = 0;
+static size_t reconnect_intervals_len = 0;
static GSList *reconnects = NULL;
--
2.2.0.rc0.207.ga3a616c