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

Cast enum to int to fix Qurt compiler warning #28638

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

Conversation

katzfey
Copy link
Contributor

@katzfey katzfey commented Nov 15, 2024

Cast enum to an int to get rid of Qurt compiler warning when max enum value is less than the constant it is being compared to. Here is the warning:

../../libraries/AP_GPS/AP_GPS.cpp:1622:14: warning: result of comparison of constant 8 with expression of type 'mavlink_channel_t' is always false [-Wtautological-constant-out-of-range-compare]
if (chan >= MAVLINK_COMM_NUM_BUFFERS) {
~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~

…is less than the constant being compared to.
@peterbarker
Copy link
Contributor

We went the other way for a similar thing:

libraries/GCS_MAVLink/GCS_MAVLink.h:#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"

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