summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/strbuf.hxx24
-rw-r--r--sal/inc/rtl/string.hxx20
-rw-r--r--sal/inc/rtl/stringutils.hxx2
-rw-r--r--sal/inc/rtl/ustrbuf.hxx35
-rw-r--r--sal/inc/rtl/ustring.hxx36
-rw-r--r--sal/qa/rtl/strings/test_ostring_stringliterals.cxx19
6 files changed, 1 insertions, 135 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.
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index 0fcbb842753d..139c5e4ca21b 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -76,8 +76,6 @@ CPPUNIT_TEST_SUITE_END();
void test::ostring::StringLiterals::checkCtors()
{
-// string literal ctors do not work with SFINAE broken and are disabled
-#if ! HAVE_SFINAE_ANONYMOUS_BROKEN
bool result_tmp;
CPPUNIT_ASSERT( CONST_CTOR_USED( "test" ));
const char good1[] = "test";
@@ -115,17 +113,6 @@ void test::ostring::StringLiterals::checkCtors()
// Check that contents are correct and equal to the case when RTL_CONSTASCII_STRINGPARAM is used.
CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "" )) == rtl::OString( "" ));
CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "ab" )) == rtl::OString( "ab" ));
-#if 0
-// This is currently disabled because it can't be consistent with HAVE_SFINAE_ANONYMOUS_BROKEN.
-// Since the situation wasn't quite consistent even before, there should be no big harm.
-
-// Check also that embedded \0 is included (RTL_CONSTASCII_STRINGPARAM does the same,
-// const char* ctor does not, but it seems to make more sense to include it when
-// it's explicitly mentioned in the string literal).
- CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "\0" )) == rtl::OString( "\0" ));
- CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "a\0b" )) == rtl::OString( "a\0b" ));
-#endif
-#endif
}
const char test::ostring::StringLiterals::bad5[] = "test";
@@ -159,11 +146,9 @@ void test::ostring::StringLiterals::checkUsage()
rtl_string_unittest_const_literal_function = false;
CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = "foo" );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
-#if ! HAVE_SFINAE_ANONYMOUS_BROKEN
rtl_string_unittest_const_literal_function = false;
CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( "fOo" ));
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
-#endif
rtl_string_unittest_const_literal_function = false;
CPPUNIT_ASSERT( foobarfoo.match( "bar", 3 ));
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
@@ -264,7 +249,6 @@ void test::ostring::StringLiterals::checkNonConstUsage()
void test::ostring::StringLiterals::checkBuffer()
{
rtl::OStringBuffer buf;
-#if ! HAVE_SFINAE_ANONYMOUS_BROKEN
rtl_string_unittest_const_literal_function = false;
buf.append( "foo" );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
@@ -277,9 +261,6 @@ void test::ostring::StringLiterals::checkBuffer()
buf.insert( 3, "baz" );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
CPPUNIT_ASSERT_EQUAL( rtl::OString( "foobazbar" ), buf.toString());
-#else
- buf.append( "foobazbar" );
-#endif
rtl::OString foobazbard( "foobazbard" );
rtl::OString foodbazbard( "foodbazbard" );