ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.02k stars 17.57k forks source link

Compilation warnings for AP_DroneCAN - narrowing conversion #23921

Open Ryanf55 opened 1 year ago

Ryanf55 commented 1 year ago

Bug report

Issue details

Compilation warnings/errors have been introduced in AP_DroneCAN from a narrowing conversion.

Version Master hash 64292958694d532b6bb92d6c8ea7c5210fc5c5a1

Platform [x] All [ ] AntennaTracker [ ] Copter [ ] Plane [ ] Rover [ ] Submarine

Airframe type What type of airframe (flying wing, glider, hex, Y6, octa etc)

Hardware type What autopilot hardware was used? (Pixhawk, Cube, Pixracer, Navio2, etc)

Logs

$ rm -r build
$ colcon build
../../libraries/AP_DroneCAN/AP_Canard_iface.cpp: In member function ‘virtual bool CanardInterface::broadcast(const Canard::Transfer&)’:
../../libraries/AP_DroneCAN/AP_Canard_iface.cpp:64:39: error: narrowing conversion of ‘(uint32_t)bcast_transfer.Canard::Transfer::payload_len’ from ‘uint32_t’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘short unsigned int’} [-Werror=narrowing]
   64 |         .payload_len = bcast_transfer.payload_len,
      |                        ~~~~~~~~~~~~~~~^~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: some warnings being treated as errors
Ryanf55 commented 1 year ago

@bugobliterator Would you be able to issue a fix for this? The blame shows this was introduced in commit: https://github.com/ArduPilot/ardupilot/commit/0c728972ff0690737e2f455b5808667915e8f597