diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-12-11 16:00:00 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-12-11 16:12:35 +0100 |
commit | 20b720ba3790d657ea3112fde0678c262908a1b6 (patch) | |
tree | af21f60de2fcc6ad0368f3c4b5bce7c547e39e9c | |
parent | 2ac26dc83f2ce9c2b41f9d9b33dd4c0cdd8d1272 (diff) |
Introduce SAL_DELETE
Change-Id: I7ac7392646ea34fb2e6a9f15990aca05a2c1e484
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 5 | ||||
-rw-r--r-- | sal/inc/sal/types.h | 18 | ||||
-rw-r--r-- | sfx2/inc/sfx2/docfile.hxx | 2 |
3 files changed, 21 insertions, 4 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index d48245beeeb4..2095cd5af514 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -29,6 +29,7 @@ #include <rtl/ustrbuf.h> #include <rtl/ustring.hxx> #include <rtl/stringutils.hxx> +#include <sal/types.h> #ifdef RTL_FAST_STRING #include <rtl/stringconcat.hxx> @@ -574,7 +575,6 @@ public: sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN]; return append( sz, rtl_ustr_valueOfBoolean( sz, b ) ); } -#ifdef HAVE_CXX11_DELETE #ifndef HAVE_SFINAE_ANONYMOUS_BROKEN // Pointer can be automatically converted to bool, which is unwanted here. // Explicitly delete all pointer append() overloads to prevent this @@ -582,8 +582,7 @@ public: template< typename T > typename internal::Enable< void, !internal::CharPtrDetector< T* >::ok && !internal::SalUnicodePtrDetector< T* >::ok >::Type - append( T* ) = delete; -#endif + append( T* ) SAL_DELETE; #endif // This overload is needed because OUString has a ctor from rtl_uString*, but diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h index bc9b2ef9a853..46f600310b6c 100644 --- a/sal/inc/sal/types.h +++ b/sal/inc/sal/types.h @@ -23,6 +23,10 @@ #include <sal/config.h> #include <sal/macros.h> +#if defined LIBO_INTERNAL_ONLY +#include <config_global.h> +#endif + /* Grab __SIZEOFxxx constants from typesconfig tool on Unix */ #if defined UNX #include <sal/typesizes.h> @@ -395,6 +399,20 @@ namespace com { namespace sun { namespace star { } } } */ namespace css = ::com::sun::star; +/** C++11 "= delete" feature. + + With HAVE_CXX11_DELETE, calling a deleted function will cause a compile-time + error, while otherwise it will only cause a link-time error as the declared + function is not defined. + + @since LibreOffice 4.1 +*/ +#if defined HAVE_CXX11_DELETE +#define SAL_DELETE = delete +#else +#define SAL_DELETE +#endif + #endif /* __cplusplus */ #ifdef __cplusplus diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index f989fdefb77b..43675fa275b5 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -94,7 +94,7 @@ public: // original overload have been adapted (in platform // specific code etc.): SfxMedium(String const &, StreamMode, void *) - /* = delete */; + SAL_DELETE; SfxMedium( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const String& rBaseURL, |