[Libreoffice-commits] core.git: include/rtl

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 23 11:27:55 UTC 2021


 include/rtl/string.hxx |    6 ------
 1 file changed, 6 deletions(-)

New commits:
commit 9eba8aa38db3a0dc2f7dfaf24a003c16418aef18
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Apr 23 11:18:56 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Apr 23 13:27:11 2021 +0200

    Remove dubious #pragma pack
    
    ...that were introduced with bca539e889d40e06cb3275442622cb075b2484a2 "make
    OString(OStringLiteral) constructor constexpr", apparently to mimic the
    corresponding #pragma pack for rtl_String in include/rtl/string.h.  But neither
    of them appear to have any value:  All struct member types involved
    (oslInterlockedCount aka sal_Int32, sal_Int32 itself, and char) have size < 8,
    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_String) and alignof(OStringLiteral<N>)
    affected, which remain e.g. 4 on x86-64.  (And prior to
    bca539e889d40e06cb3275442622cb075b2484a2, OStringLiteral did not have any pragma
    pack cargo cult, but which did not cause OStringLiteral::assertLayout to fail,
    or raise any other documented issues.)
    
    So remove the pragma pack cargo cult again at least from OStringLiteral.  (And
    leave potential removal from rtl_String for another commit.)
    
    (This is similar to the corresponding f62cb40bdfaf41cf8e989640f9be79f652f30914
    "Remove dubious #pragma pack" for OUStringLiteral.)
    
    Change-Id: I7808837a667bca717aa2e3abfdf9cb16268789ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114535
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index 98abce8fca53..a6812cc7c7df 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -134,9 +134,6 @@ private:
         static_assert(offsetof(OStringLiteral, str.buffer) == offsetof(OStringLiteral, more.buffer));
     }
 
-#if defined(_WIN32)
-#pragma pack(push, 8)
-#endif
     union {
         rtl_String str;
         struct {
@@ -150,9 +147,6 @@ private:
                 {} //TODO: drop initialization for C++20 (P1331R2)
             };
     };
-#if defined(_WIN32)
-#pragma pack(pop)
-#endif
 };
 #endif
 


More information about the Libreoffice-commits mailing list