summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2016-12-12 00:45:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-12-12 12:24:11 +0000
commitd5d6ee3b3e7cf3d93f892a452244051e4294fe6d (patch)
treeb5b8ef0467a4a05029affd1f9ed4021fa95ef76c /cppu
parent033ff2f9ad739e09e9b0a986ffccb4e908a83212 (diff)
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/31878 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/uno/check.cxx36
1 files changed, 31 insertions, 5 deletions
diff --git a/cppu/source/uno/check.cxx b/cppu/source/uno/check.cxx
index 620a97072a68..9a734a78e8cf 100644
--- a/cppu/source/uno/check.cxx
+++ b/cppu/source/uno/check.cxx
@@ -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);