Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble/host: Fix compilation issues observed by enabling -O2 optimiza… #1686

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

rahult-github
Copy link
Contributor

@rahult-github rahult-github commented Feb 7, 2024

When O2 optimization is enabled, below error is thrown . This patch fixes the same.

nimble/host/src/ble_gattc.c: In function 'ble_gattc_find_inc_svcs_rx_adata':
nimble/host/src/ble_gattc.c:1982:25: note: 'service' declared here
1982 | struct ble_gatt_svc service;
| ^~~~~~~
In function 'ble_gattc_find_inc_svcs_cb',
inlined from 'ble_gattc_find_inc_svcs_rx_adata' at nimble/host/src/ble_gattc.c:2031:16:
nimble/host/src/ble_gattc.c:1832:14: error: 'service' may be used uninitialized [-Werror=maybe-uninitialized]
1832 | rc = proc->find_inc_svcs.cb(proc->conn_handle,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1833 | ble_gattc_error(status, att_handle),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1834 | service, proc->find_inc_svcs.cb_arg);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nimble/host/src/ble_gattc.c:1832:14: note: by argument 3 of type 'const struct ble_gatt_svc *' to 'ble_gatt_disc_svc_fn' {aka 'int(short unsigned int, const struct ble_gatt_error *, const struct ble_gatt_svc *, void *)'}
nimble/host/src/ble_gattc.c: In function 'ble_gattc_find_inc_svcs_rx_adata':
nimble/host/src/ble_gattc.c:1982:25: note: 'service' declared here
1982 | struct ble_gatt_svc service;

@rahult-github
Copy link
Contributor Author

Hi @sjanc , please take a look

@sjanc sjanc merged commit 768a6c7 into apache:master Feb 13, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants