diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-01 20:24:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-20 20:54:42 +0100 |
commit | db44ffd2191b7d34307e0a1c49339c490482c4ac (patch) | |
tree | 816e4abf29a6704b0a900995a0c1fc58b1ff98de /include/com/sun | |
parent | 93e3443f6c1c25533f79ac1f72f382122f00c48d (diff) |
suppress COPY_INSTEAD_OF_MOVE suggestions for uno::Reference
rtl::Reference, uno::Any and rtl::O[U]String
where we have implemented move ctors to take let the compiler take
advantage of any little optimization possibility that it can take
but where the potential optimization probably doesn't outweigh
enforcing dusting error-prone std::move all over every case where
the compiler doesn't/can't use the move ctor but could.
Change-Id: Icf184d96d3278a1740a76c7eb1150e60392351ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162337
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'include/com/sun')
-rw-r--r-- | include/com/sun/star/uno/Any.h | 2 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.hxx | 2 | ||||
-rw-r--r-- | include/com/sun/star/uno/Reference.h | 2 | ||||
-rw-r--r-- | include/com/sun/star/uno/Reference.hxx | 3 |
4 files changed, 9 insertions, 0 deletions
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index 14eb9035495f..d522d7309076 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -146,7 +146,9 @@ public: inline Any & SAL_CALL operator = ( const Any & rAny ); #if defined LIBO_INTERNAL_ONLY +#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions inline Any(Any && other) noexcept; +#endif inline Any & operator =(Any && other) noexcept; #endif diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 75ae40b48f26..0573ad9681a0 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -133,6 +133,7 @@ inline Any & Any::operator = ( const Any & rAny ) #if defined LIBO_INTERNAL_ONLY +#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions Any::Any(Any && other) noexcept { uno_any_construct(this, nullptr, nullptr, &cpp_acquire); std::swap(other.pType, pType); @@ -146,6 +147,7 @@ Any::Any(Any && other) noexcept { // only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData -> // _assignData takes a null pSource to mean "construct a default value"). } +#endif Any & Any::operator =(Any && other) noexcept { std::swap(other.pType, pType); diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h index 417d28b0418b..cff277630465 100644 --- a/include/com/sun/star/uno/Reference.h +++ b/include/com/sun/star/uno/Reference.h @@ -264,7 +264,9 @@ public: @param rRef another reference */ +#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions inline Reference( Reference< interface_type > && rRef ) noexcept; +#endif /** Up-casting conversion constructor: Copies interface reference. diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx index 76b01b6c57cf..900170cf802d 100644 --- a/include/com/sun/star/uno/Reference.hxx +++ b/include/com/sun/star/uno/Reference.hxx @@ -129,12 +129,15 @@ inline Reference< interface_type >::Reference( const Reference< interface_type > } #if defined LIBO_INTERNAL_ONLY + +#if !defined(__COVERITY__) template< class interface_type > inline Reference< interface_type >::Reference( Reference< interface_type > && rRef ) noexcept { _pInterface = rRef._pInterface; rRef._pInterface = nullptr; } +#endif template< class interface_type > template< class derived_type > inline Reference< interface_type >::Reference( |