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

Fix two warnings recently introduced #1501

Merged
merged 2 commits into from
Aug 5, 2021
Merged

Fix two warnings recently introduced #1501

merged 2 commits into from
Aug 5, 2021

Conversation

julianoes
Copy link
Collaborator

@julianoes julianoes commented Aug 5, 2021

Found by AppleClang:

/Users/julianoes/src/MAVSDK/src/core/system_impl.cpp:1384:66: warning: self-comparison always evaluates to true [-Wtautological-compare]
    return _parent.get_base_mode() & (MAV_MODE_FLAG_SAFETY_ARMED == MAV_MODE_FLAG_SAFETY_ARMED);

And GCC:

/home/julianoes/src/MAVSDK/src/plugins/mission_raw_server/mission_raw_server_impl.cpp:315:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<mavsdk::MAVLinkMissionTransfer::ItemInt>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  315 |     if (_current_seq + 1 == _current_mission.size()) {
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

@julianoes julianoes added the bug label Aug 5, 2021
@julianoes julianoes requested a review from bazfp August 5, 2021 09:21
src/core/system_impl.cpp Show resolved Hide resolved
@bazfp
Copy link
Collaborator

bazfp commented Aug 5, 2021

D:\a\MAVSDK\MAVSDK\src\core\system_impl.cpp(1384,39): error C2220: the following warning is treated as an error [D:\a\MAVSDK\MAVSDK\build\release\src\core\mavsdk.vcxproj]
D:\a\MAVSDK\MAVSDK\src\core\system_impl.cpp(1384,39): warning C4806: '&': unsafe operation: no value of type 'bool' promoted to type 'MAV_MODE_FLAG' can equal the given constant 

Oopsie! bool MavsdkImpl::get_base_mode() const

This should be uint8_t

@julianoes julianoes changed the title core: fix is_server_armed check Fix two warnings recently introduced Aug 5, 2021
@julianoes julianoes merged commit 3204b40 into main Aug 5, 2021
@julianoes julianoes deleted the pr-fix-armed branch August 5, 2021 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants