[Libreoffice-commits] core.git: include/rtl
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 23 06:11:37 UTC 2021
include/rtl/ustring.hxx | 6 ------
1 file changed, 6 deletions(-)
New commits:
commit f62cb40bdfaf41cf8e989640f9be79f652f30914
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Apr 22 14:49:06 2021 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Apr 23 08:10:55 2021 +0200
Remove dubious #pragma pack
...that were introduced with 21584b304b21bfe6b99b6f29018c6b754ea28fc0 "make
OUString(OUStringLiteral) constructor constexpr", apparently to mimic the
corresponding #pragma pack for rtl_uString in include/rtl/ustring.h. But
neither of them appear to have any value: All struct member types involved
(oslInterlockedCount aka sal_Int32, sal_Int32 itself, and sal_Unicode) have size
<= 4, so the member alignment ("on a boundary that's either a multiple of [the
pragma pack value], or a multiple of the size of the member, whichever is
smaller", according to
<https://docs.microsoft.com/en-us/cpp/preprocessor/pack?view=msvc-160>) is not
affected. And neither are alignof(rtl_uString) and alignof(OUStringLiteral<N>)
affected, which remain e.g. 4 on x86-64. (And prior to
21584b304b21bfe6b99b6f29018c6b754ea28fc0, OUStringLiteral did not have any
pragma pack cargo cult, but which did not cause OUStringLiteral::assertLayout to
fail, or raise any other documented issues.)
So remove the pragma pack cargo cult again at least from OUStringLiteral. (And
leave potential removal from rtl_uString for another commit.)
Change-Id: I1a3626f0db1a0413ff792bd00ebaf76e4249b13f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114484
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Jenkins
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index e1ae2d38f2d9..2699c09ac03f 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -115,9 +115,6 @@ private:
static_assert(offsetof(OUStringLiteral, str.buffer) == offsetof(OUStringLiteral, more.buffer));
}
-#if defined(_WIN32)
-#pragma pack(push, 4)
-#endif
union {
rtl_uString str;
struct {
@@ -131,9 +128,6 @@ private:
{} //TODO: drop initialization for C++20 (P1331R2)
};
};
-#if defined(_WIN32)
-#pragma pack(pop)
-#endif
};
#if defined RTL_STRING_UNITTEST
More information about the Libreoffice-commits
mailing list