Unverified Commit 774154e3 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #8769 from airmap/address_of_packed_member

-Waddress-of-packed-member build error fix
parents 55c2c50c 6a5a15ae
......@@ -50,7 +50,6 @@ linux {
DEFINES += QGC_GST_TAISYNC_ENABLED
DEFINES += QGC_GST_MICROHARD_ENABLED
QMAKE_CXXFLAGS_WARN_ON += -Werror \
-Wno-address-of-packed-member \ # Mavlink headers
-Wno-unused-parameter \ # gst_plugins-good has these errors
-Wno-implicit-fallthrough \ # gst_plugins-good has these errors
-Wno-unused-command-line-argument \ # from somewhere in Qt generated build files
......@@ -118,7 +117,6 @@ linux {
#QMAKE_MAC_SDK = macosx10.15
QMAKE_CXXFLAGS += -fvisibility=hidden
QMAKE_CXXFLAGS_WARN_ON += -Werror \
-Wno-address-of-packed-member \ # Mavlink headers
-Wno-unused-parameter # gst-plugins-good
} else {
error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported")
......
......@@ -35,7 +35,7 @@ CONFIG += QGC_DISABLE_PX4_PLUGIN_FACTORY
DEFINES += CUSTOMHEADER=\"\\\"CustomPlugin.h\\\"\"
DEFINES += CUSTOMCLASS=CustomPlugin
TARGET = MyGroundStation
TARGET = CustomQGroundControl
DEFINES += QGC_APPLICATION_NAME='"\\\"Custom QGroundControl\\\""'
DEFINES += QGC_ORG_NAME=\"\\\"qgroundcontrol.org\\\"\"
......
......@@ -1179,6 +1179,24 @@ void Vehicle::_handleDistanceSensor(mavlink_message_t& message)
}
}
// Ignore warnings from mavlink headers for both GCC/Clang and MSVC
#ifdef __GNUC__
#if __GNUC__ > 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Waddress-of-packed-member"
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#endif
#else
#pragma warning(push, 0)
#endif
void Vehicle::_handleAttitudeTarget(mavlink_message_t& message)
{
mavlink_attitude_target_t attitudeTarget;
......@@ -2003,6 +2021,17 @@ void Vehicle::_handleRCChannelsRaw(mavlink_message_t& message)
emit rcChannelsChanged(channelCount, pwmValues);
}
// Pop warnings ignoring for mavlink headers for both GCC/Clang and MSVC
#ifdef __GNUC__
#if defined(__clang__)
#pragma clang diagnostic pop
#else
#pragma GCC diagnostic pop
#endif
#else
#pragma warning(pop, 0)
#endif
void Vehicle::_handleScaledPressure(mavlink_message_t& message) {
mavlink_scaled_pressure_t pressure;
mavlink_msg_scaled_pressure_decode(&message, &pressure);
......
......@@ -127,6 +127,24 @@ int UAS::getUASID() const
return uasId;
}
// Ignore warnings from mavlink headers for both GCC/Clang and MSVC
#ifdef __GNUC__
#if __GNUC__ > 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Waddress-of-packed-member"
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#endif
#else
#pragma warning(push, 0)
#endif
void UAS::receiveMessage(mavlink_message_t message)
{
// Only accept messages from this system (condition 1)
......@@ -327,6 +345,17 @@ void UAS::receiveMessage(mavlink_message_t message)
}
}
// Pop warnings ignoring for mavlink headers for both GCC/Clang and MSVC
#ifdef __GNUC__
#if defined(__clang__)
#pragma clang diagnostic pop
#else
#pragma GCC diagnostic pop
#endif
#else
#pragma warning(pop, 0)
#endif
void UAS::startCalibration(UASInterface::StartCalibrationType calType)
{
if (!_vehicle) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment