include/com/sun/star/uno/Any.h         |    2 ++
 include/com/sun/star/uno/Any.hxx       |    2 ++
 include/com/sun/star/uno/Reference.h   |    2 ++
 include/com/sun/star/uno/Reference.hxx |    3 +++
 include/rtl/ref.hxx                    |    2 ++
 include/rtl/string.hxx                 |    2 ++
 include/rtl/ustring.hxx                |    2 ++
 7 files changed, 15 insertions(+)

New commits:
commit db44ffd2191b7d34307e0a1c49339c490482c4ac
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Jan 1 20:24:22 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Jan 20 20:54:42 2024 +0100

    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 <[email protected]>

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(
diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx
index 38dfe3769e81..99a7dfccce79 100644
--- a/include/rtl/ref.hxx
+++ b/include/rtl/ref.hxx
@@ -83,6 +83,7 @@ public:
     }
 
 #ifdef LIBO_INTERNAL_ONLY
+#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
     /** Move constructor...
      */
     Reference (Reference<reference_type> && handle) noexcept
@@ -91,6 +92,7 @@ public:
         handle.m_pBody = nullptr;
     }
 #endif
+#endif
 
 #if defined LIBO_INTERNAL_ONLY
     /** Up-casting conversion constructor: Copies interface reference.
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index 91fb155a5e9d..93aca37ffd7d 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -229,6 +229,7 @@ public:
     }
 
 #if defined LIBO_INTERNAL_ONLY
+#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
     /**
       Move constructor.
 
@@ -255,6 +256,7 @@ public:
         str.pData = nullptr;
         rtl_string_new( &str.pData );
     }
+#endif
 #endif
 
     /**
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index c32a083f10b5..9d897f2e84de 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -208,6 +208,7 @@ public:
     }
 
 #if defined LIBO_INTERNAL_ONLY
+#if !defined(__COVERITY__) // suppress COPY_INSTEAD_OF_MOVE suggestions
     /**
       Move constructor.
 
@@ -234,6 +235,7 @@ public:
         str.pData = nullptr;
         rtl_uString_new( &str.pData );
     }
+#endif
 #endif
 
     /**

Reply via email to