Fix clang warnings (#4988)

* Fix clang warnings

- signed char on AVR vs unsigned char on ARM
- use references instead of points in calculation (same code size)
- Ignore packed address warning for mavlink includes
- Turn error on packed addresses to warning for Horus (Cannot fix that without major refactoring, might even need eeprom change)

* Revert fixes for clang on AVR as the old AVR gcc does not like them
This commit is contained in:
Arne Schwabe
2017-07-30 09:59:15 +02:00
committed by Bertrand Songis
parent 3436273fdf
commit a7524ba74d
3 changed files with 21 additions and 1 deletions
+11
View File
@@ -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();
}