mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
902 stars 993 forks source link

Stop warnings when compiling a ROS program that use mavros #1447

Closed sshmaxime closed 4 years ago

sshmaxime commented 4 years ago

Hello, this isn't really a bug HOWEVER how can I make mavros stop giving warning when compiling my program ?

Such as:

In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/callbacks.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const Mavlink&, mavlink::mavlink_message_t&)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:74:63: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   74 |  std::copy(rmsg.payload64.begin(), rmsg.payload64.end(), mmsg.payload64);
      |                                                          ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/callbacks.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const mavlink_message_t&, mavros_msgs::Mavlink&, uint8_t)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:108:72: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  108 |  rmsg.payload64 = std::move(mavros_msgs::Mavlink::_payload64_type(mmsg.payload64, mmsg.payload64 + payload64_len));
      |                                                                   ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/command.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const Mavlink&, mavlink::mavlink_message_t&)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:74:63: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   74 |  std::copy(rmsg.payload64.begin(), rmsg.payload64.end(), mmsg.payload64);
      |                                                          ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/command.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const mavlink_message_t&, mavros_msgs::Mavlink&, uint8_t)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:108:72: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  108 |  rmsg.payload64 = std::move(mavros_msgs::Mavlink::_payload64_type(mmsg.payload64, mmsg.payload64 + payload64_len));
      |                                                                   ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/executors.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const Mavlink&, mavlink::mavlink_message_t&)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:74:63: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   74 |  std::copy(rmsg.payload64.begin(), rmsg.payload64.end(), mmsg.payload64);
      |                                                          ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/command/executors.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const mavlink_message_t&, mavros_msgs::Mavlink&, uint8_t)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:108:72: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  108 |  rmsg.payload64 = std::move(mavros_msgs::Mavlink::_payload64_type(mmsg.payload64, mmsg.payload64 + payload64_len));
      |                                                                   ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/main.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const Mavlink&, mavlink::mavlink_message_t&)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:74:63: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
   74 |  std::copy(rmsg.payload64.begin(), rmsg.payload64.end(), mmsg.payload64);
      |                                                          ~~~~~^~~~~~~~~
In file included from /opt/ros/noetic/include/mavros/utils.h:22,
                 from /opt/ros/noetic/include/mavros/mavros_uas.h:30,
                 from /opt/ros/noetic/include/mavros/mavros_plugin.h:25,
                 from /home/workspace/src/src/command/command.hpp:16,
                 from /home/workspace/src/src/main.cpp:5:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h: In function ‘bool mavros_msgs::mavlink::convert(const mavlink_message_t&, mavros_msgs::Mavlink&, uint8_t)’:
/opt/ros/noetic/include/mavros_msgs/mavlink_convert.h:108:72: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  108 |  rmsg.payload64 = std::move(mavros_msgs::Mavlink::_payload64_type(mmsg.payload64, mmsg.payload64 + payload64_len));
      |                                                                   ~~~~~^~~~~~~~~
amilcarlucas commented 4 years ago

Recompile again with the latest mavros master. the warnings should be gone

tkazik commented 3 years ago

Just got the same warning. My setup:

...
.../src/mavros/mavros_msgs/include/mavros_msgs/mavlink_convert.h:108:62: warning: taking address of packed member of ‘mavlink::__mavlink_message’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  108 |  rmsg.payload64 = mavros_msgs::Mavlink::_payload64_type(mmsg.payload64, mmsg.payload64 + payload64_len);
...

Any ideas? Mind to reopen?