[apps/shared] Revert to pack record

It appeared that without the packed keyword, the compiler did not handle
access to unaligned record data members, which leads to crashes on the
device.

Change-Id: I401f075e7f62458a4733baa8d81983d4be34b730
This commit is contained in:
Hugo Saint-Vignes
2020-06-24 16:27:41 +02:00
committed by Émilie Feral
parent 969fea7494
commit 5bc19af196
6 changed files with 25 additions and 30 deletions

View File

@@ -9,7 +9,7 @@ namespace Shared {
template<class F>
void interactWithBaseRecordMember(F * fct) {
/* Accessing Function record member m_color, which has a 2-byte alignment
* Only efffective in DEBUG=1, as there are no compiler optimizations */
* Only effective in DEBUG=1, as there are no compiler optimizations */
KDColor color = fct->color();
(void) color; // Silence compilation warning about unused variable.
}
@@ -68,11 +68,11 @@ void testAlignmentHandlingFor() {
sharedStorage->destroyAllRecords();
}
QUIZ_CASE(alignment_handled_on_emscripten) {
QUIZ_CASE(alignment_handling) {
/* This test main function is to crash if storage alignment is not handled
* properly on DEBUG and __EMSCRIPTEN__ modes only. It also ensures that the
* right test - load and store of differently-aligned objects - is performed
* (if storage/record implementations change for instance). */
* properly. It also ensures that the right test - load and store of
* differently-aligned objects - is performed (if storage/record
* implementations change for instance). */
testAlignmentHandlingFor<Sequence::SequenceStore>();
testAlignmentHandlingFor<Graph::ContinuousFunctionStore>();
}