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

AP_Baro: To prevent incorrect warnings #28321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

muramura
Copy link
Contributor

@muramura muramura commented Oct 6, 2024

BUF is a stack variable.
It is not used after being released. Suppress the compiler warning.

[ 84/1342] Compiling libraries/AP_Baro/AP_Baro_BMP388.cpp
../../libraries/AP_Baro/AP_Baro_BMP388.cpp: In member function ‘void AP_Baro_BMP388::timer()’:
../../libraries/AP_Baro/AP_Baro_BMP388.cpp:148:34: warning: dangling pointer to ‘buf’ may be used [-Wdangling-pointer=]
148 | update_temperature((buf[6] << 16) | (buf[5] << 8) | buf[4]);
| ~~~~~^
../../libraries/AP_Baro/AP_Baro_BMP388.cpp:136:13: note: ‘buf’ declared here
136 | uint8_t buf[7];
| ^~~

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. We're going to have to limit this to specific versions of compilers - not understood on older GCCs, for example

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