diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-04-04 13:34:58 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-04-04 13:44:30 +0200 |
commit | 598d3228cdcd66a79740bd05740f3e2169b1ec98 (patch) | |
tree | 814696626fba31cd58f8cf9cbccbed5dc8a1d160 /sal/inc | |
parent | d9e0c08b52dca00508485cc7a8082200a2693ec9 (diff) |
remove HAVE_SFINAE_ANONYMOUS_BROKEN
Since we no longer support the old Apple SDK using gcc-4.0.1, we can
remove the cruft to work around its problems. Woohoo.
Change-Id: Idf275e76449443f1f0314e75dab993f213a77eb7
Diffstat (limited to 'sal/inc')
-rw-r--r-- | sal/inc/rtl/strbuf.hxx | 24 | ||||
-rw-r--r-- | sal/inc/rtl/string.hxx | 20 | ||||
-rw-r--r-- | sal/inc/rtl/stringutils.hxx | 2 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 35 | ||||
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 36 |
5 files changed, 1 insertions, 116 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index d858c89023da..9ebd495239cd 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -154,15 +154,6 @@ public: @overload @since LibreOffice 3.6 */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN // see the OString ctors - OStringBuffer( const char* value ) - : pData(NULL) - { - sal_Int32 length = rtl_str_getLength( value ); - nCapacity = length + 16; - rtl_stringbuffer_newFromStr_WithLength( &pData, value, length ); - } -#else template< typename T > OStringBuffer( const T& value, typename internal::CharPtrDetector< T, internal::Dummy >::Type = internal::Dummy()) : pData(NULL) @@ -203,7 +194,6 @@ public: rtl_string_unittest_const_literal = true; #endif } -#endif // HAVE_SFINAE_ANONYMOUS_BROKEN /** Constructs a string buffer so that it represents the same @@ -458,12 +448,6 @@ public: @param str the characters to be appended. @return this string buffer. */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN - OStringBuffer & append( const sal_Char * str ) - { - return append( str, rtl_str_getLength( str ) ); - } -#else template< typename T > typename internal::CharPtrDetector< T, OStringBuffer& >::Type append( const T& str ) { @@ -489,7 +473,6 @@ public: rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), literal, internal::ConstCharArrayDetector< T, void >::size - 1 ); return *this; } -#endif /** Appends the string representation of the <code>char</code> array @@ -669,12 +652,6 @@ public: @param str a character array. @return this string buffer. */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN - OStringBuffer & insert( sal_Int32 offset, const sal_Char * str ) - { - return insert( offset, str, rtl_str_getLength( str ) ); - } -#else template< typename T > typename internal::CharPtrDetector< T, OStringBuffer& >::Type insert( sal_Int32 offset, const T& str ) { @@ -700,7 +677,6 @@ public: rtl_stringbuffer_insert( &pData, &nCapacity, offset, literal, internal::ConstCharArrayDetector< T, void >::size - 1 ); return *this; } -#endif /** Inserts the string representation of the <code>char</code> array diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index f9eeda2d7799..e3d5afbc895a 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -165,17 +165,6 @@ public: @param value a NULL-terminated character array. */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN - // Old gcc can try to convert anonymous enums to OString and give compile error. - // So there's no special-cased handling of string literals. - // These are inline functions and technically both variants should work - // the same in practice, so there should be no compatibility problem. - OString( const sal_Char * value ) SAL_THROW(()) - { - pData = 0; - rtl_string_newFromStr( &pData, value ); - } -#else template< typename T > OString( const T& value, typename internal::CharPtrDetector< T, internal::Dummy >::Type = internal::Dummy() ) SAL_THROW(()) { @@ -214,8 +203,6 @@ public: #endif } -#endif // HAVE_SFINAE_ANONYMOUS_BROKEN - /** New string from a character buffer array. @@ -542,12 +529,6 @@ public: @return sal_True if the strings are equal; sal_False, otherwise. */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN - sal_Bool equalsIgnoreAsciiCase( const sal_Char * asciiStr ) const SAL_THROW(()) - { - return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0; - } -#else template< typename T > typename internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase( const T& asciiStr ) const SAL_THROW(()) { @@ -575,7 +556,6 @@ public: return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length, literal, internal::ConstCharArrayDetector< T, void >::size - 1 ) == 0; } -#endif /** Perform a ASCII lowercase comparison of two strings. diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx index 7ca2281a8230..f8323082ca40 100644 --- a/sal/inc/rtl/stringutils.hxx +++ b/sal/inc/rtl/stringutils.hxx @@ -34,14 +34,12 @@ // Manually defining RTL_DISABLE_FAST_STRING allows to force turning fast string concatenation off // (e.g. for debugging). #ifndef RTL_DISABLE_FAST_STRING -#if ! HAVE_SFINAE_ANONYMOUS_BROKEN // This feature is not part of public API and is meant to be used only internally by LibreOffice. #ifdef LIBO_INTERNAL_ONLY // Enable fast string concatenation. #define RTL_FAST_STRING #endif #endif -#endif // The unittest uses slightly different code to help check that the proper // calls are made. The class is put into a different namespace to make diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index abbf3d01ade5..b648714aad97 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -146,37 +146,6 @@ public: rtl_uStringbuffer_newFromStr_WithLength( &pData, value.getStr(), value.getLength() ); } -#if HAVE_SFINAE_ANONYMOUS_BROKEN // see OUString ctors - template< int N > - OUStringBuffer( const char (&literal)[ N ] ) - : pData(NULL) - , nCapacity( N - 1 + 16 ) - { - assert( strlen( literal ) == N - 1 ); - rtl_uString_newFromLiteral( &pData, literal, N - 1, 16 ); -#ifdef RTL_STRING_UNITTEST - rtl_string_unittest_const_literal = true; -#endif - } - - /** - * It is an error to call this overload. Strings cannot directly use non-const char[]. - * @internal - */ - template< int N > - OUStringBuffer( char (&value)[ N ] ) -#ifndef RTL_STRING_UNITTEST - ; // intentionally not implemented -#else - { - (void) value; // unused - pData = 0; - nCapacity = 10; - rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage - rtl_string_unittest_invalid_conversion = true; - } -#endif -#else // HAVE_SFINAE_ANONYMOUS_BROKEN template< typename T > OUStringBuffer( T& literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type = internal::Dummy() ) : pData(NULL) @@ -188,7 +157,6 @@ public: rtl_string_unittest_const_literal = true; #endif } -#endif // HAVE_SFINAE_ANONYMOUS_BROKEN #ifdef RTL_STRING_UNITTEST /** @@ -592,7 +560,7 @@ public: sal_Unicode sz[RTL_USTR_MAX_VALUEOFBOOLEAN]; return append( sz, rtl_ustr_valueOfBoolean( sz, b ) ); } -#if ! HAVE_SFINAE_ANONYMOUS_BROKEN + // Pointer can be automatically converted to bool, which is unwanted here. // Explicitly delete all pointer append() overloads to prevent this // (except for char* and sal_Unicode* overloads, which are handled elsewhere). @@ -600,7 +568,6 @@ public: typename internal::Enable< void, !internal::CharPtrDetector< T* >::ok && !internal::SalUnicodePtrDetector< T* >::ok >::Type append( T* ) SAL_DELETED_FUNCTION; -#endif // This overload is needed because OUString has a ctor from rtl_uString*, but // the bool overload above would be prefered to the conversion. diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index 0af8b6d548ac..13756f868198 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -193,39 +193,6 @@ public: @since LibreOffice 3.6 */ -#if HAVE_SFINAE_ANONYMOUS_BROKEN - // Old gcc can try to convert anonymous enums to OUString and give compile error. - // So instead have a variant for const and non-const char[]. - template< int N > - OUString( const char (&literal)[ N ] ) - { - // Check that the string literal is in fact N - 1 long (no embedded \0's), - // any decent compiler should optimize out calls to strlen with literals. - assert( strlen( literal ) == N - 1 ); - pData = 0; - rtl_uString_newFromLiteral( &pData, literal, N - 1, 0 ); -#ifdef RTL_STRING_UNITTEST - rtl_string_unittest_const_literal = true; -#endif - } - - /** - * It is an error to call this overload. Strings cannot directly use non-const char[]. - * @internal - */ - template< int N > - OUString( char (&value)[ N ] ) -#ifndef RTL_STRING_UNITTEST - ; // intentionally not implemented -#else - { - (void) value; // unused - pData = 0; - rtl_uString_newFromLiteral( &pData, "!!br0ken!!", 10, 0 ); // set to garbage - rtl_string_unittest_invalid_conversion = true; - } -#endif -#else // HAVE_SFINAE_ANONYMOUS_BROKEN template< typename T > OUString( T& literal, typename internal::ConstCharArrayDetector< T, internal::Dummy >::Type = internal::Dummy() ) { @@ -240,9 +207,6 @@ public: #endif } -#endif // HAVE_SFINAE_ANONYMOUS_BROKEN - - #ifdef RTL_STRING_UNITTEST /** * Only used by unittests to detect incorrect conversions. |