Kaydet (Commit) d5d6ee3b authored tarafından John Paul Adrian Glaubitz's avatar John Paul Adrian Glaubitz Kaydeden (comit) Caolán McNamara

uno: Add support for targets with 16-bit alignment

Despite being a 32-bit architecture, m68k has a basic
alignment of 16-bit for historic reasons. On m68k,
SAL_TYPES_ALIGNMENT8 is therefore equal to 2 and we
need to cover this case in the static asserts as well.

Change-Id: I4c756af25d57e5d49209697f6e678ef71a5845aa
Reviewed-on: https://gerrit.libreoffice.org/31878Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 033ff2f9
......@@ -151,7 +151,10 @@ static_assert( static_cast<sal_Bool>(true) == sal_True,
"must be binary compatible" );
static_assert( static_cast<sal_Bool>(false) == sal_False,
"must be binary compatible" );
#if SAL_TYPES_ALIGNMENT8 == 4
#if SAL_TYPES_ALIGNMENT8 == 2
static_assert(offsetof(AlignSize_Impl, dDouble) == 2, "offsetof(AlignSize_Impl, dDouble) != 2");
static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
#elif SAL_TYPES_ALIGNMENT8 == 4
static_assert(offsetof(AlignSize_Impl, dDouble) == 4, "offsetof(AlignSize_Impl, dDouble) != 4");
static_assert(sizeof(AlignSize_Impl) == 12, "sizeof(AlignSize_Impl) != 12");
#elif SAL_TYPES_ALIGNMENT8 == 8
......@@ -181,7 +184,9 @@ static_assert(sizeof(N) == 12, "sizeof(N) != 12");
static_assert(sizeof(N2) == 12, "sizeof(N2) != 12");
static_assert(offsetof(N2, p) == 8, "offsetof(N2, p) != 8");
#if SAL_TYPES_ALIGNMENT8 == 4
#if SAL_TYPES_ALIGNMENT8 == 2
static_assert(sizeof(O) == 16, "sizeof(O) != 16");
#elif SAL_TYPES_ALIGNMENT8 == 4
static_assert(sizeof(O) == 20, "sizeof(O) != 20");
#elif SAL_TYPES_ALIGNMENT8 == 8
static_assert(sizeof(O) == 24, "sizeof(O) != 24");
......@@ -196,7 +201,14 @@ static_assert(offsetof(E, e) == 8, "offsetof(E, e) != 8");
static_assert(sizeof(C1) == 2, "sizeof(C1) != 2");
static_assert(sizeof(C2) == 8, "sizeof(C2) != 8");
#if SAL_TYPES_ALIGNMENT8 == 4
#if SAL_TYPES_ALIGNMENT8 == 2
static_assert(sizeof(C3) == 18, "sizeof(C3) != 18");
static_assert(sizeof(C4) == 30, "sizeof(C4) != 30");
static_assert(sizeof(C5) == 40, "sizeof(C5) != 40");
static_assert(sizeof(C6) == 44, "sizeof(C6) != 44");
static_assert(sizeof(O2) == 18, "sizeof(O2) != 18");
#elif SAL_TYPES_ALIGNMENT8 == 4
static_assert(sizeof(C3) == 20, "sizeof(C3) != 20");
static_assert(sizeof(C4) == 32, "sizeof(C4) != 32");
static_assert(sizeof(C5) == 44, "sizeof(C5) != 44");
......@@ -216,7 +228,10 @@ static_assert(sizeof(O2) == 32, "sizeof(O2) != 32");
static_assert(sizeof(Char3) == 3, "sizeof(Char3) != 3");
#if SAL_TYPES_ALIGNMENT8 == 4
#if SAL_TYPES_ALIGNMENT8 == 2
// max alignment is 2
static_assert(sizeof(P) == 16, "sizeof(P) != 16");
#elif SAL_TYPES_ALIGNMENT8 == 4
// max alignment is 4
static_assert(sizeof(P) == 20, "sizeof(P) != 20");
#elif SAL_TYPES_ALIGNMENT8 == 8
......@@ -242,7 +257,18 @@ BinaryCompatible_Impl::BinaryCompatible_Impl()
assert(OFFSET_OF(C2, n2) == 4);
#if SAL_TYPES_ALIGNMENT8 == 4
#if SAL_TYPES_ALIGNMENT8 == 2
assert(OFFSET_OF(C3, d3) == 6);
assert(OFFSET_OF(C3, n3) == 14);
assert(OFFSET_OF(C4, n4) == 18);
assert(OFFSET_OF(C4, d4) == 22);
assert(OFFSET_OF(C5, n5) == 30);
assert(OFFSET_OF(C5, b5) == 38);
assert(OFFSET_OF(C6, c6) == 2);
assert(OFFSET_OF(C6, b6) == 42);
assert(OFFSET_OF(O2, p2) == 16);
#elif SAL_TYPES_ALIGNMENT8 == 4
assert(OFFSET_OF(C3, d3) == 8);
assert(OFFSET_OF(C3, n3) == 16);
assert(OFFSET_OF(C4, n4) == 20);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment