From 7f1dea61294ac0a3c7418abc48c2e15f697f895c Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 30 Dec 2017 11:16:35 +0100 Subject: [PATCH] Silence CLangs warnings so -DWARNING_AS_ERROR does not break the build under OS X --- radio/src/definitions.h | 7 +++++-- radio/src/maths.cpp | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/radio/src/definitions.h b/radio/src/definitions.h index df5bb4165..20d8e5352 100644 --- a/radio/src/definitions.h +++ b/radio/src/definitions.h @@ -21,8 +21,11 @@ #ifndef _DEFINITIONS_H_ #define _DEFINITIONS_H_ -#if defined(SIMU) - #define __ALIGNED +#if defined(SIMU) && __GNUC__ + #define __ALIGNED __attribute__((aligned(32))) + #define __SECTION_USED(s) __attribute__((used)) +#elif defined(SIMU) + #define __ALIGNED #define __SECTION_USED(s) #else #define __ALIGNED __attribute__((aligned(32))) diff --git a/radio/src/maths.cpp b/radio/src/maths.cpp index f1244b1af..b93aaa3e1 100644 --- a/radio/src/maths.cpp +++ b/radio/src/maths.cpp @@ -138,6 +138,11 @@ void extractLatitudeLongitude(uint32_t * latitude, uint32_t * longitude) *longitude = ((uint32_t)(qr.quot) * 1000000) + (((uint32_t)(qr.rem) * 10000 + telemetryData.hub.gpsLongitude_ap) * 5) / 3; } +#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 warning "-Waddress-of-packed-member" +#endif void getGpsPilotPosition() { extractLatitudeLongitude(&telemetryData.hub.pilotLatitude, &telemetryData.hub.pilotLongitude);