From 63dfd069b3a957361881c12ccba38c5a23b9a42f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 22 Aug 2019 15:42:36 +0300 Subject: Mark move ctors/assignments noexcept This should enable using move semantics where possible e.g. in standard containers. According to https://en.cppreference.com/w/cpp/language/move_constructor: To make strong exception guarantee possible, user-defined move constructors should not throw exceptions. For example, std::vector relies on std::move_if_noexcept to choose between move and copy when the elements need to be relocated. Change-Id: I6e1e1cdd5cd430b139ffa2fa7031fb0bb625decb Reviewed-on: https://gerrit.libreoffice.org/77957 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- connectivity/source/commontools/FValue.cxx | 4 ++-- connectivity/source/commontools/dbmetadata.cxx | 4 ++-- connectivity/source/drivers/dbase/dindexnode.cxx | 2 +- connectivity/source/inc/dbase/dindexnode.hxx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 51adab4f3e98..bf79ffd5ac7b 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -259,7 +259,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) } -void ORowSetValue::free() +void ORowSetValue::free() noexcept { if(!m_bNull) { @@ -470,7 +470,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) return *this; } -ORowSetValue& ORowSetValue::operator=(ORowSetValue&& _rRH) +ORowSetValue& ORowSetValue::operator=(ORowSetValue&& _rRH) noexcept { if ( m_eTypeKind != _rRH.m_eTypeKind || !m_bNull) free(); diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 026381e0377b..d345aec78cac 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -188,7 +188,7 @@ namespace dbtools { } - DatabaseMetaData::DatabaseMetaData( DatabaseMetaData&& _copyFrom ) + DatabaseMetaData::DatabaseMetaData(DatabaseMetaData&& _copyFrom) noexcept :m_pImpl(std::move(_copyFrom.m_pImpl)) { } @@ -202,7 +202,7 @@ namespace dbtools return *this; } - DatabaseMetaData& DatabaseMetaData::operator=( DatabaseMetaData&& _copyFrom ) + DatabaseMetaData& DatabaseMetaData::operator=(DatabaseMetaData&& _copyFrom) noexcept { m_pImpl = std::move(_copyFrom.m_pImpl); return *this; diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index be85e87096b4..10231a835ff9 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -809,7 +809,7 @@ ONDXPagePtr::ONDXPagePtr() { } -ONDXPagePtr::ONDXPagePtr(ONDXPagePtr&& rRef) +ONDXPagePtr::ONDXPagePtr(ONDXPagePtr&& rRef) noexcept { mpPage = rRef.mpPage; rRef.mpPage = nullptr; diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index 8a8110253edc..6d891239e8ab 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -92,7 +92,7 @@ namespace connectivity public: ONDXPagePtr(); - ONDXPagePtr(ONDXPagePtr&& rObj); + ONDXPagePtr(ONDXPagePtr&& rObj) noexcept; ONDXPagePtr(ONDXPagePtr const & rRef); ONDXPagePtr(ONDXPage* pRefPage); ~ONDXPagePtr(); -- cgit