sw/inc/swrect.hxx | 16 ++-------------- sw/source/core/bastyp/swrect.cxx | 2 ++ tools/source/generic/gen.cxx | 7 +++++++ 3 files changed, 11 insertions(+), 14 deletions(-)
New commits: commit 328f91e0d373006f0039c16cde28f44116f45f29 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Sep 16 23:15:45 2021 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri Sep 17 08:50:48 2021 +0200 ensure that some basic geometry classes are trivially copyable They in practice are, since they are just integers, but SwRect had explicit implementations of some functions that technically prevented SwRect from being considered trivially copyable, even though they were identical to default implementations. Change-Id: Ib5086dcd5279f3b4c0c530535c91524671cc6656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122128 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index c0153ef93d3f..5de1dfe6ce32 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -39,7 +39,7 @@ class SAL_WARN_UNUSED SW_DLLPUBLIC SwRect public: inline SwRect(); - inline SwRect( const SwRect &rRect ); + inline SwRect( const SwRect &rRect ) = default; inline SwRect( const Point& rLT, const Size& rSize ); inline SwRect( const Point& rLT, const Point& rRB ); inline SwRect( tools::Long X, tools::Long Y, tools::Long Width, tools::Long Height ); @@ -91,7 +91,7 @@ public: inline bool IsEmpty() const; inline void Clear(); - inline SwRect &operator = ( const SwRect &rRect ); + SwRect &operator = ( const SwRect &rRect ) = default; inline bool operator == ( const SwRect& rRect ) const; inline bool operator != ( const SwRect& rRect ) const; @@ -249,13 +249,6 @@ inline tools::Long SwRect::Bottom() const return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); } -// operators -inline SwRect &SwRect::operator = ( const SwRect &rRect ) -{ - m_Point = rRect.m_Point; - m_Size = rRect.m_Size; - return *this; -} inline bool SwRect::operator == ( const SwRect& rRect ) const { return (m_Point == rRect.m_Point && m_Size == rRect.m_Size); @@ -307,11 +300,6 @@ inline SwRect::SwRect() : m_Size( 0, 0 ) { } -inline SwRect::SwRect( const SwRect &rRect ) : - m_Point( rRect.m_Point ), - m_Size( rRect.m_Size ) -{ -} inline SwRect::SwRect( const Point& rLT, const Size& rSize ) : m_Point( rLT ), m_Size( rSize ) diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index 3809c2113c04..7d9f38412ae6 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -240,4 +240,6 @@ SvStream& WriteSwRect(SvStream &rStream, const SwRect &rRect) } #endif +static_assert( std::is_trivially_copyable< SwRect >::value ); + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index e16d85698c0e..9fd9c020c0a2 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -276,4 +276,11 @@ tools::Long tools::Rectangle::getHeight() const return nBottom == RECT_EMPTY ? 0 : nBottom - nTop; } +static_assert( std::is_trivially_copyable< Pair >::value ); +static_assert( std::is_trivially_copyable< Point >::value ); +static_assert( std::is_trivially_copyable< Size >::value ); +static_assert( std::is_trivially_copyable< Range >::value ); +static_assert( std::is_trivially_copyable< Selection >::value ); +static_assert( std::is_trivially_copyable< tools::Rectangle >::value ); + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */