From 9b792c3cf1601d809f6700550e34ae527b8a8078 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Sat, 4 Mar 2017 00:22:40 +0000 Subject: [PATCH] ICU-12736 remove remaining uses of now-obsolete U_HAVE_STD_STRING X-SVN-Rev: 39733 --- icu4c/source/Doxyfile.in | 2 +- icu4c/source/common/unicode/bytestream.h | 4 --- icu4c/source/common/unicode/platform.h | 11 ------ icu4c/source/common/uposixdefs.h | 14 -------- icu4c/source/configure.ac | 13 ------- icu4c/source/test/intltest/collationtest.cpp | 4 --- icu4c/source/test/intltest/rbbiapts.cpp | 10 +++--- icu4c/source/test/intltest/strcase.cpp | 4 --- icu4c/source/test/intltest/uts46test.cpp | 4 +-- icu4c/source/tools/gennorm2/n2builder.cpp | 2 -- icu4c/source/tools/toolutil/udbgutil.cpp | 36 -------------------- 11 files changed, 7 insertions(+), 97 deletions(-) diff --git a/icu4c/source/Doxyfile.in b/icu4c/source/Doxyfile.in index fde612523db..8104be3a047 100644 --- a/icu4c/source/Doxyfile.in +++ b/icu4c/source/Doxyfile.in @@ -194,7 +194,7 @@ EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END= U_NO_THROW=\ "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_HAVE_STD_STRING=1 U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1 U_OVERRIDE= U_FINAL= UCONFIG_ENABLE_PLUGINS=1 +PREDEFINED = U_EXPORT2= U_STABLE= U_DRAFT= U_INTERNAL= U_SYSTEM= U_DEPRECATED= U_OBSOLETE= U_CALLCONV= U_CDECL_BEGIN= U_CDECL_END= U_NO_THROW=\ "U_NAMESPACE_BEGIN=namespace icu{" "U_NAMESPACE_END=}" U_SHOW_CPLUSPLUS_API=1 U_DEFINE_LOCAL_OPEN_POINTER()= U_IN_DOXYGEN=1 U_OVERRIDE= U_FINAL= UCONFIG_ENABLE_PLUGINS=1 EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- diff --git a/icu4c/source/common/unicode/bytestream.h b/icu4c/source/common/unicode/bytestream.h index f45cb0c8dfb..a31992e99e8 100644 --- a/icu4c/source/common/unicode/bytestream.h +++ b/icu4c/source/common/unicode/bytestream.h @@ -222,8 +222,6 @@ private: CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assignment operator not implemented }; -#if U_HAVE_STD_STRING - /** * Implementation of ByteSink that writes to a "string". * The StringClass is usually instantiated with a std::string. @@ -252,8 +250,6 @@ class StringByteSink : public ByteSink { StringByteSink &operator=(const StringByteSink &); ///< assignment operator not implemented }; -#endif - U_NAMESPACE_END #endif // __BYTESTREAM_H__ diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index d29ab677e56..b553b6878da 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -343,17 +343,6 @@ #define U_IOSTREAM_SOURCE 199711 #endif -/** - * \def U_HAVE_STD_STRING - * Defines whether the standard C++ (STL) <string> header is available. - * @internal - */ -#ifdef U_HAVE_STD_STRING - /* Use the predefined value. */ -#else -# define U_HAVE_STD_STRING 1 -#endif - /*===========================================================================*/ /** @{ Compiler and environment features */ /*===========================================================================*/ diff --git a/icu4c/source/common/uposixdefs.h b/icu4c/source/common/uposixdefs.h index b6ee427891a..5750e652219 100644 --- a/icu4c/source/common/uposixdefs.h +++ b/icu4c/source/common/uposixdefs.h @@ -58,18 +58,4 @@ # define _XOPEN_SOURCE_EXTENDED 1 #endif -/* - * There is an issue with turning on _XOPEN_SOURCE_EXTENDED on certain platforms. - * A compatibility issue exists between turning on _XOPEN_SOURCE_EXTENDED and using - * standard C++ string class. As a result, standard C++ string class needs to be - * turned off for the follwing platforms: - * -AIX/VACPP - * -Solaris/GCC - */ -#if (U_PLATFORM == U_PF_AIX && !defined(__GNUC__)) || (U_PLATFORM == U_PF_SOLARIS && defined(__GNUC__)) -# if _XOPEN_SOURCE_EXTENDED && !defined(U_HAVE_STD_STRING) -// TODO: conflicts with unconditional use of std::string # define U_HAVE_STD_STRING 0 -# endif -#endif - #endif /* __UPOSIXDEFS_H__ */ diff --git a/icu4c/source/configure.ac b/icu4c/source/configure.ac index f1494d572f6..b6065af7997 100644 --- a/icu4c/source/configure.ac +++ b/icu4c/source/configure.ac @@ -514,19 +514,6 @@ if [[ "$GXX" = yes ]]; then fi fi -AC_MSG_CHECKING([[if #include works]]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_stdstring=yes], [ac_cv_header_stdstring=no]) -AC_MSG_RESULT($ac_cv_header_stdstring) -if test $ac_cv_header_stdstring = yes -then - U_HAVE_STD_STRING=1 -else - U_HAVE_STD_STRING=0 - CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STD_STRING=0" -fi -AC_SUBST(U_HAVE_STD_STRING) - - AC_MSG_CHECKING([[if #include works]]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no]) AC_MSG_RESULT($ac_cv_header_atomic) diff --git a/icu4c/source/test/intltest/collationtest.cpp b/icu4c/source/test/intltest/collationtest.cpp index 36f3d8b374f..94d5055f3d9 100644 --- a/icu4c/source/test/intltest/collationtest.cpp +++ b/icu4c/source/test/intltest/collationtest.cpp @@ -481,7 +481,6 @@ void CollationTest::TestFCD() { CodePointIterator cpi(cp, UPRV_LENGTHOF(cp)); checkFCD("FCDUTF16CollationIterator", u16ci, cpi); -#if U_HAVE_STD_STRING cpi.resetToStart(); std::string utf8; UnicodeString(s).toUTF8String(utf8); @@ -491,7 +490,6 @@ void CollationTest::TestFCD() { return; } checkFCD("FCDUTF8CollationIterator", u8ci, cpi); -#endif cpi.resetToStart(); UCharIterator iter; @@ -1607,7 +1605,6 @@ UBool CollationTest::checkCompareTwo(const char *norm, const UnicodeString &prev } } -#if U_HAVE_STD_STRING // compare(UTF-16) treats unpaired surrogates like unassigned code points. // Unpaired surrogates cannot be converted to UTF-8. // Create valid UTF-16 strings if necessary, and use those for @@ -1672,7 +1669,6 @@ UBool CollationTest::checkCompareTwo(const char *norm, const UnicodeString &prev return FALSE; } } -#endif UCharIterator leftIter; UCharIterator rightIter; diff --git a/icu4c/source/test/intltest/rbbiapts.cpp b/icu4c/source/test/intltest/rbbiapts.cpp index 90a4e902de0..8ed7c072310 100644 --- a/icu4c/source/test/intltest/rbbiapts.cpp +++ b/icu4c/source/test/intltest/rbbiapts.cpp @@ -25,7 +25,7 @@ #include "unicode/ustring.h" #include "unicode/utext.h" #include "cmemory.h" -#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING +#if !UCONFIG_NO_BREAK_ITERATION #include "unicode/filteredbrk.h" #include // for sprintf #endif @@ -1154,7 +1154,7 @@ void RBBIAPITest::TestRefreshInputText() { } -#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION +#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION static void prtbrks(BreakIterator* brk, const UnicodeString &ustr, IntlTest &it) { static const UChar PILCROW=0x00B6, CHSTR=0x3010, CHEND=0x3011; // lenticular brackets it.logln(UnicodeString("String:'")+ustr+UnicodeString("'")); @@ -1196,7 +1196,7 @@ static void prtbrks(BreakIterator* brk, const UnicodeString &ustr, IntlTest &it) #endif void RBBIAPITest::TestFilteredBreakIteratorBuilder() { -#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION +#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION UErrorCode status = U_ZERO_ERROR; LocalPointer builder; LocalPointer baseBI; @@ -1392,7 +1392,7 @@ void RBBIAPITest::TestFilteredBreakIteratorBuilder() { } #else - logln("Skipped- not: !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION"); + logln("Skipped- not: !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION"); #endif } @@ -1423,7 +1423,7 @@ void RBBIAPITest::runIndexedTest( int32_t index, UBool exec, const char* &name, TESTCASE_AUTO(TestGetBinaryRules); #endif TESTCASE_AUTO(TestRefreshInputText); -#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING +#if !UCONFIG_NO_BREAK_ITERATION TESTCASE_AUTO(TestFilteredBreakIteratorBuilder); #endif TESTCASE_AUTO_END; diff --git a/icu4c/source/test/intltest/strcase.cpp b/icu4c/source/test/intltest/strcase.cpp index eb06ca1b0df..99a11af5ac1 100644 --- a/icu4c/source/test/intltest/strcase.cpp +++ b/icu4c/source/test/intltest/strcase.cpp @@ -666,7 +666,6 @@ StringCaseTest::assertGreekUpper(const char *s, const char *expected) { } } -#if U_HAVE_STD_STRING UErrorCode errorCode = U_ZERO_ERROR; LocalUCaseMapPointer csm(ucasemap_open("el", 0, &errorCode)); assertSuccess("ucasemap_open", errorCode); @@ -710,7 +709,6 @@ StringCaseTest::assertGreekUpper(const char *s, const char *expected) { assertEquals(msg + cap + " (memcmp)", 0, memcmp(dest8, dest8b, expected8Length)); } } -#endif } void @@ -884,7 +882,6 @@ void StringCaseTest::TestBufferOverflow() { } errorCode.reset(); -#if U_HAVE_STD_STRING std::string data_utf8; data.toUTF8String(data_utf8); result = ucasemap_utf8ToTitle(csm.getAlias(), NULL, 0, data_utf8.c_str(), data_utf8.length(), errorCode); @@ -894,7 +891,6 @@ void StringCaseTest::TestBufferOverflow() { __FILE__, __LINE__, data_utf8.length(), errorCode.errorName(), result); } errorCode.reset(); -#endif // U_HAVE_STD_STRING } void StringCaseTest::checkEditsIter( diff --git a/icu4c/source/test/intltest/uts46test.cpp b/icu4c/source/test/intltest/uts46test.cpp index 6566e1041d8..077dadf0ec6 100644 --- a/icu4c/source/test/intltest/uts46test.cpp +++ b/icu4c/source/test/intltest/uts46test.cpp @@ -830,8 +830,7 @@ void UTS46Test::TestSomeCases() { continue; } } - // UTF-8 if we have std::string -#if U_HAVE_STD_STRING + // UTF-8 std::string input8, aT8, uT8, aN8, uN8; StringByteSink aT8Sink(&aT8), uT8Sink(&uT8), aN8Sink(&aN8), uN8Sink(&uN8); IDNAInfo aT8Info, uT8Info, aN8Info, uN8Info; @@ -879,7 +878,6 @@ void UTS46Test::TestSomeCases() { testCase.o, (int)i, testCase.s); continue; } -#endif } } diff --git a/icu4c/source/tools/gennorm2/n2builder.cpp b/icu4c/source/tools/gennorm2/n2builder.cpp index 940db3b13c4..17aecffd567 100644 --- a/icu4c/source/tools/gennorm2/n2builder.cpp +++ b/icu4c/source/tools/gennorm2/n2builder.cpp @@ -25,9 +25,7 @@ #include #include #include -#if U_HAVE_STD_STRING #include -#endif #include "unicode/errorcode.h" #include "unicode/localpointer.h" #include "unicode/putil.h" diff --git a/icu4c/source/tools/toolutil/udbgutil.cpp b/icu4c/source/tools/toolutil/udbgutil.cpp index fbb30ce3299..192d38d8a55 100644 --- a/icu4c/source/tools/toolutil/udbgutil.cpp +++ b/icu4c/source/tools/toolutil/udbgutil.cpp @@ -613,40 +613,6 @@ U_CAPI char *udbg_knownIssueURLFrom(const char *ticket, char *buf) { } -#if !U_HAVE_STD_STRING -const char *warning = "WARNING: Don't have std::string (STL) - known issue logs will be deficient."; - -U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket, - UBool *firstForWhere) { - if(ptr==NULL) { - puts(warning); - } - printf("%s\tKnown Issue #%s\n", where, ticket); - - return (void*)warning; -} - -U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket, - UBool *firstForWhere) { - if(ptr==NULL) { - puts(warning); - } - if(msg==NULL) msg = ""; - printf("%s\tKnown Issue #%s \"%s\n", where, ticket, msg); - - return (void*)warning; -} - -U_CAPI UBool udbg_knownIssue_print(void *ptr) { - puts(warning); - return FALSE; -} - -U_CAPI void udbg_knownIssue_close(void *ptr) { - // nothing to do -} -#else - #include #include #include @@ -785,5 +751,3 @@ U_CAPI void udbg_knownIssue_close(void *ptr) { KnownIssues *t = static_cast(ptr); delete t; } - -#endif