compilerplugins/clang/test/unoany.cxx |    1 -
 include/com/sun/star/uno/Any.h        |   16 ++++++++--------
 include/com/sun/star/uno/Any.hxx      |   18 ++++++------------
 include/tools/color.hxx               |    6 ------
 4 files changed, 14 insertions(+), 27 deletions(-)

New commits:
commit abac7828ae85ecb42e73e83141f6e6c475b66db2
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu May 5 11:42:23 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu May 5 14:26:32 2022 +0200

    Deprecate css::uno::makeAny; completely disable it for LIBO_INTERNAL_ONLY
    
    There is just no good reason not to use a css::uno::Any constructor 
instead, so
    simplify the code base.  For URE backwards compatibility, keep it around as
    deprecated for !LIBO_INTERNAL_ONLY.
    
    Change-Id: I9409d8853cac270d47377a31ba35a1fc23fa9800
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133879
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/test/unoany.cxx 
b/compilerplugins/clang/test/unoany.cxx
index 15c4b3ae2436..b5d91007f80f 100644
--- a/compilerplugins/clang/test/unoany.cxx
+++ b/compilerplugins/clang/test/unoany.cxx
@@ -22,7 +22,6 @@ int main()
     css::uno::Any b;
     a = b;
     a = getAny();
-    a = css::uno::makeAny(true); // expected-error {{unnecessary copy, rather 
use <<= operator directly with the 'makeAny' argument [loplugin:unoany]}}
     a = css::uno::Any(true); // expected-error {{unnecessary copy, rather use 
<<= operator directly with the 'Any' constructor argument [loplugin:unoany]}}
 }
 
diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h
index e2fc8af41f62..123952142517 100644
--- a/include/com/sun/star/uno/Any.h
+++ b/include/com/sun/star/uno/Any.h
@@ -48,7 +48,7 @@ class Type;
 /** C++ class representing an IDL any.
     This class is used to transport any type defined in IDL. The class 
inherits from the
     binary C representation of uno_Any.
-    You can insert a value by either using the <<= operators or the template 
function makeAny().
+    You can insert a value by using the <<= operators.
     No any can hold an any. You can extract values from an any by using the 
>>= operators which
     return true if the any contains an assignable value (no data loss), e.g. 
the any contains a
     short and you >>= it into a long variable.
@@ -303,12 +303,13 @@ template<> bool Any::has<sal_uInt16>() const 
SAL_DELETED_FUNCTION;
 /// @endcond
 #endif
 
+#if !defined LIBO_INTERNAL_ONLY
 /** Template function to generically construct an any from a C++ value.
 
-    This can be useful with an explicitly specified template parameter, when 
the
+    @deprecated Just use an Any constructor with an appropriately typed 
argument.  (When the
     (UNO) type recorded in the Any instance shall be different from what would
-    be deduced from the (C++) type of the argument if no template parameter 
were
-    specified explicitly.
+    be deduced from the (C++) type of the argument, cast the argument to the 
appropriate type
+    first.)
 
     @tparam C value type
     @param value a value
@@ -317,16 +318,15 @@ template<> bool Any::has<sal_uInt16>() const 
SAL_DELETED_FUNCTION;
 template< class C >
 inline Any SAL_CALL makeAny( const C & value );
 
-#if !defined LIBO_INTERNAL_ONLY
 template<> inline Any SAL_CALL makeAny(sal_uInt16 const & value);
-#endif
 
 template<> Any SAL_CALL makeAny(Any const &) SAL_DELETED_FUNCTION;
+#endif
 
 /** Wrap a value in an Any, if necessary.
 
-    The difference to makeAny is that makeAny cannot be called on an Any, while
-    toAny just returns the given Any.
+    (A difference to the deprecated makeAny is that makeAny cannot be called 
on an Any, while
+    toAny just returns the given Any.)
 
     @since LibreOffice 5.0
 */
diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx
index 1427cb4c14f6..5613269c2b57 100644
--- a/include/com/sun/star/uno/Any.hxx
+++ b/include/com/sun/star/uno/Any.hxx
@@ -230,38 +230,32 @@ inline bool Any::operator != ( const Any & rAny ) const
 }
 
 
+#if !defined LIBO_INTERNAL_ONLY
 template< class C >
 inline Any SAL_CALL makeAny( const C & value )
 {
     return Any(value);
 }
 
-#if !defined LIBO_INTERNAL_ONLY
 template<> Any makeAny(sal_uInt16 const & value)
 { return Any(&value, cppu::UnoType<cppu::UnoUnsignedShortType>::get()); }
 #endif
 
-template<typename T> Any toAny(T const & value) { return makeAny(value); }
+template<typename T> Any toAny(T const & value) {
+    return Any(value);
+}
 
 template<> Any toAny(Any const & value) { return value; }
 
 #if defined LIBO_INTERNAL_ONLY
 
-template<typename T1, typename T2>
-Any makeAny(rtl::OUStringConcat<T1, T2> && value)
-{ return Any(std::move(value)); }
-
 template<typename T1, typename T2>
 Any toAny(rtl::OUStringConcat<T1, T2> && value)
-{ return makeAny(std::move(value)); }
-
-template<typename T>
-Any makeAny(rtl::OUStringNumber<T> && value)
-{ return Any(OUString(std::move(value))); }
+{ return Any(std::move(value)); }
 
 template<typename T>
 Any toAny(rtl::OUStringNumber<T> && value)
-{ return makeAny(std::move(value)); }
+{ return Any(std::move(value)); }
 
 template<typename T> bool fromAny(Any const & any, T * value) {
     assert(value != nullptr);
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index e2b1783f5e5d..0d4990b63eab 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -438,12 +438,6 @@ inline void operator <<=( css::uno::Any & rAny, Color 
value )
 
 namespace com::sun::star::uno {
     template<> inline Any::Any(Color const & value): Any(sal_Int32(value)) {}
-
-    template<>
-    inline Any makeAny( Color const & value )
-    {
-        return Any(sal_Int32(value));
-    }
 }
 
 // Test compile time conversion of Color to sal_uInt32

Reply via email to