diff --git a/src/main/blackbox/blackbox.c b/src/main/blackbox/blackbox.c index d70fb399d2..db7f0e7fdc 100644 --- a/src/main/blackbox/blackbox.c +++ b/src/main/blackbox/blackbox.c @@ -1045,6 +1045,13 @@ static void writeInterframe(void) blackboxLoggedAnyFrames = true; } +// for gcc9 (and maybe later), we warn on (mainly harmless) unaligned packed structure member pointer access +// minimise the effect to the affected functions and compiler versions. +#if (__GNUC__ >= 9) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif + /* Write the contents of the global "slowHistory" to the log as an "S" frame. Because this data is logged so * infrequently, delta updates are not reasonable, so we log independent frames. */ static void writeSlowFrame(void) @@ -1131,6 +1138,10 @@ static void loadSlowState(blackboxSlowState_t *slow) } +#if (__GNUC__ >= 9) +#pragma GCC diagnostic pop +#endif + /** * If the data in the slow frame has changed, log a slow frame. * diff --git a/src/main/telemetry/mavlink.c b/src/main/telemetry/mavlink.c index 660e6f74c5..e9fd6931ad 100755 --- a/src/main/telemetry/mavlink.c +++ b/src/main/telemetry/mavlink.c @@ -75,6 +75,10 @@ // until this is resolved in mavlink library - ignore -Wpedantic for mavlink code #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" +// For gcc9, the mavlink libary also fails on unaligned unaligned packed structure member pointer access +#if (__GNUC__ >= 9) +#pragma GCC diagnostic ignored "-Waddress-of-packed-member" +#endif #include "common/mavlink.h" #pragma GCC diagnostic pop