diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 5b7fe65d0..d51037830 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2483,7 +2483,18 @@ void opentxInit(OPENTX_INIT_ARGS) // g_model.topbarData is still zero here (because it was not yet read from SDCARD), // but we only remember the pointer to in in constructor. // The storageReadAll() needs topbar object, so it must be created here +#if __clang__ +// clang does not like this at all, turn into a warning so that -Werror does not stop here +// taking address of packed member 'topbarData' of class or structure 'ModelData' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] +#pragma clang diagnostic push +#pragma clang diagnostic warning "-Waddress-of-packed-member" +#endif topbar = new Topbar(&g_model.topbarData); +#if __clang__ +// Restore warnings +#pragma clang diagnostic pop +#endif + // lua widget state must also be prepared before the call to storageReadAll() LUA_INIT_THEMES_AND_WIDGETS(); } diff --git a/radio/src/storage/sdcard_raw.cpp b/radio/src/storage/sdcard_raw.cpp index c6636cd58..ac5b70de2 100644 --- a/radio/src/storage/sdcard_raw.cpp +++ b/radio/src/storage/sdcard_raw.cpp @@ -32,7 +32,7 @@ const char * writeFile(const char * filename, const uint8_t * data, uint16_t siz TRACE("writeFile(%s)", filename); FIL file; - char buf[8]; + unsigned char buf[8]; UINT written; FRESULT result = f_open(&file, filename, FA_CREATE_ALWAYS | FA_WRITE); diff --git a/radio/src/telemetry/mavlink.h b/radio/src/telemetry/mavlink.h index 7eb80b070..40540ecb6 100644 --- a/radio/src/telemetry/mavlink.h +++ b/radio/src/telemetry/mavlink.h @@ -48,7 +48,16 @@ extern void SERIAL_send_uart_bytes(const uint8_t * buf, uint16_t len); #define MAVLINK_END_UART_SEND(chan,len) SERIAL_end_uart_send() #define MAVLINK_SEND_UART_BYTES(chan,buf,len) SERIAL_send_uart_bytes(buf,len) +#if __clang__ +// clang does not like packed member access at all. Since mavlink is a 3rd party library, ignore the errors +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Waddress-of-packed-member" +#endif #include "GCS_MAVLink/include_v1.0/ardupilotmega/mavlink.h" +#if __clang__ +// Restore warnings about packed member access +#pragma clang diagnostic pop +#endif //#define MAVLINK_PARAMS //#define DUMP_RX_TX