diff --git a/QGCCommon.pri b/QGCCommon.pri index 0d6be11268198abf418f16ca546a247035c7eb3e..5820b7603413c8a507ae94779c4fec22de69fceb 100644 --- a/QGCCommon.pri +++ b/QGCCommon.pri @@ -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") diff --git a/custom-example/custom.pri b/custom-example/custom.pri index 5f68ac774c90eadad1f2c806cb1c683ec2bd9023..c5325f5537302e5070158246d47085f6b3b29e25 100644 --- a/custom-example/custom.pri +++ b/custom-example/custom.pri @@ -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\\\"\" diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index baf2a39523b7fee2bd4ce3bc219aaa25b164bf53..beefecaa077b7bb8922bcec0a70e9abe5d4c3aef 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -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); diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index ab6dcc4dfc53ef96534d828e81bab15717f28b0a..b789b7f4b0eb35782e0c8b9ed09b8511dbf3ed63 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -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) {