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/ll: Fix build with clang 11 on mac #1899

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

sjanc
Copy link
Contributor

@sjanc sjanc commented Oct 29, 2024

Looks like clang is not able to track relation between max_delay and calc_sch which are involve two separate if-else blocks.

This is false positive.

repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:9:
error: variable 'max_delay' is used uninitialized whenever 'if' condition
is false [-Werror,-Wsometimes-uninitialized]
if (calc_sch) {
^~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:586:35:
note: uninitialized use occurs here
rc = ble_ll_sched_insert(sch, max_delay, preempt_none);
^~~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:5:
note: remove the 'if' if its condition is always true
if (calc_sch) {
^~~~~~~~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:431:23:
note: initialize the variable 'max_delay' to silence this warning
uint32_t max_delay;
^
= 0

Looks like clang is not able to track relation between max_delay and
calc_sch which are involve two separate if-else blocks.

This is false positive.

repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:9:
    error: variable 'max_delay' is used uninitialized whenever 'if' condition
        is false [-Werror,-Wsometimes-uninitialized]
    if (calc_sch) {
        ^~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:586:35:
    note: uninitialized use occurs here
    rc = ble_ll_sched_insert(sch, max_delay, preempt_none);
                                  ^~~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:5:
    note: remove the 'if' if its condition is always true
    if (calc_sch) {
    ^~~~~~~~~~~~~~
repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:431:23:
    note: initialize the variable 'max_delay' to silence this warning
    uint32_t max_delay;
                      ^
                       = 0
@sjanc sjanc merged commit b1ec600 into apache:master Oct 30, 2024
18 checks passed
@sjanc sjanc deleted the clang_osx branch October 30, 2024 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controller size/XS Extra small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants