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/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 14ecd4a40f4b80037888286316507769b20bae0b..bd5ac5a55aae7440167214d7e4c548e7ca65281e 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -9,9 +9,22 @@ #pragma once +// 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 #include diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 331eb4f28fc339e9963d9d19f4e66558a45331d6..6788cbeb604d5d1e57149b7f7e94faff9e2b4879 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -13,9 +13,22 @@ #pragma once +// 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 #include "UASInterface.h"