mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-12766 merge from trunk
X-SVN-Rev: 39734
This commit is contained in:
commit
8d61ae06b3
18 changed files with 15 additions and 120 deletions
|
@ -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
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -702,4 +702,4 @@ FilteredBreakIteratorBuilder::createInstance(UErrorCode& status) {
|
|||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif //#if !UCONFIG_NO_BREAK_ITERATION && U_HAVE_STD_STRING && !UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
#endif //#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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 */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -27,13 +27,11 @@
|
|||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_HAVE_STD_STRING
|
||||
|
||||
// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=13364
|
||||
#if defined(__GLIBCXX__)
|
||||
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
|
||||
namespace std { class type_info; }
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#endif // U_HAVE_STD_STRING
|
||||
|
||||
#endif // __STD_STRING_H__
|
||||
|
|
|
@ -68,14 +68,12 @@ class U_COMMON_API StringPiece : public UMemory {
|
|||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const char* str);
|
||||
#if U_HAVE_STD_STRING
|
||||
/**
|
||||
* Constructs from a std::string.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const std::string& str)
|
||||
: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
|
||||
#endif
|
||||
/**
|
||||
* Constructs from a const char * pointer and a specified length.
|
||||
* @param offset a const char * pointer (need not be terminated)
|
||||
|
|
|
@ -1710,8 +1710,6 @@ public:
|
|||
*/
|
||||
void toUTF8(ByteSink &sink) const;
|
||||
|
||||
#if U_HAVE_STD_STRING
|
||||
|
||||
/**
|
||||
* Convert the UnicodeString to UTF-8 and append the result
|
||||
* to a standard string.
|
||||
|
@ -1731,8 +1729,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert the UnicodeString to UTF-32.
|
||||
* Unpaired surrogates are replaced with U+FFFD.
|
||||
|
|
|
@ -54,22 +54,8 @@
|
|||
*
|
||||
* z/OS needs this definition for timeval and to get usleep.
|
||||
*/
|
||||
#if !defined(_XOPEN_SOURCE_EXTENDED)
|
||||
#if !defined(_XOPEN_SOURCE_EXTENDED) && defined(__TOS_MVS__)
|
||||
# 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)
|
||||
# define U_HAVE_STD_STRING 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* __UPOSIXDEFS_H__ */
|
||||
|
|
|
@ -514,19 +514,6 @@ if [[ "$GXX" = yes ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([[if #include <string> works]])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string>]], [[]])], [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 <atomic> works]])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <atomic>]], [[]])], [ac_cv_header_atomic=yes], [ac_cv_header_atomic=no])
|
||||
AC_MSG_RESULT($ac_cv_header_atomic)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <stdio.h> // 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<FilteredBreakIteratorBuilder> builder;
|
||||
LocalPointer<BreakIterator> 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;
|
||||
|
|
|
@ -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);
|
||||
|
@ -702,14 +701,14 @@ StringCaseTest::assertGreekUpper(const char *s, const char *expected) {
|
|||
expectedErrorCode = U_STRING_NOT_TERMINATED_WARNING;
|
||||
} else {
|
||||
expectedErrorCode = U_ZERO_ERROR;
|
||||
assertEquals(msg + cap + " NUL", 0, dest8b[length]);
|
||||
// Casts to int32_t to avoid matching UBool.
|
||||
assertEquals(msg + cap + " NUL", (int32_t)0, (int32_t)dest8b[length]);
|
||||
}
|
||||
assertEquals(msg + cap + " errorCode", expectedErrorCode, errorCode);
|
||||
if (cap >= expected8Length) {
|
||||
assertEquals(msg + cap + " (memcmp)", 0, memcmp(dest8, dest8b, expected8Length));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -883,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);
|
||||
|
@ -893,7 +891,6 @@ void StringCaseTest::TestBufferOverflow() {
|
|||
__FILE__, __LINE__, data_utf8.length(), errorCode.errorName(), result);
|
||||
}
|
||||
errorCode.reset();
|
||||
#endif // U_HAVE_STD_STRING
|
||||
}
|
||||
|
||||
void StringCaseTest::checkEditsIter(
|
||||
|
|
|
@ -212,14 +212,12 @@ StringTest::TestStringPiece() {
|
|||
if(abcd.empty() || abcd.data()!=abcdefg_chars || abcd.length()!=4 || abcd.size()!=4) {
|
||||
errln("StringPiece(abcdefg_chars, 4) failed");
|
||||
}
|
||||
#if U_HAVE_STD_STRING
|
||||
// Construct from std::string.
|
||||
std::string uvwxyz_string("uvwxyz");
|
||||
StringPiece uvwxyz(uvwxyz_string);
|
||||
if(uvwxyz.empty() || uvwxyz.data()!=uvwxyz_string.data() || uvwxyz.length()!=6 || uvwxyz.size()!=6) {
|
||||
errln("StringPiece(uvwxyz_string) failed");
|
||||
}
|
||||
#endif
|
||||
// Substring constructor with pos.
|
||||
StringPiece sp(abcd, -1);
|
||||
if(sp.empty() || sp.data()!=abcdefg_chars || sp.length()!=4 || sp.size()!=4) {
|
||||
|
@ -463,7 +461,6 @@ StringTest::TestCheckedArrayByteSink() {
|
|||
|
||||
void
|
||||
StringTest::TestStringByteSink() {
|
||||
#if U_HAVE_STD_STRING
|
||||
// Not much to test because only the constructor and Append()
|
||||
// are implemented, and trivially so.
|
||||
std::string result("abc"); // std::string
|
||||
|
@ -472,7 +469,6 @@ StringTest::TestStringByteSink() {
|
|||
if(result != "abcdef") {
|
||||
errln("StringByteSink did not Append() as expected");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
|
|
@ -1888,13 +1888,11 @@ UnicodeStringTest::TestUTF8() {
|
|||
if(from8 != expected) {
|
||||
errln("UnicodeString::fromUTF8(StringPiece) did not create the expected string.");
|
||||
}
|
||||
#if U_HAVE_STD_STRING
|
||||
std::string utf8_string((const char *)utf8, sizeof(utf8));
|
||||
UnicodeString from8b = UnicodeString::fromUTF8(utf8_string);
|
||||
if(from8b != expected) {
|
||||
errln("UnicodeString::fromUTF8(std::string) did not create the expected string.");
|
||||
}
|
||||
#endif
|
||||
|
||||
static const UChar utf16[] = {
|
||||
0x41, 0xd900, 0x61, 0xdc00, 0x5a, 0xd900, 0xdc00, 0x7a, 0xd800, 0xdc00, 0xdbff, 0xdfff
|
||||
|
@ -1916,7 +1914,6 @@ UnicodeStringTest::TestUTF8() {
|
|||
if(!sink.calledFlush) {
|
||||
errln("UnicodeString::toUTF8(sink) did not sink.Flush().");
|
||||
}
|
||||
#if U_HAVE_STD_STRING
|
||||
// Initial contents for testing that toUTF8String() appends.
|
||||
std::string result8 = "-->";
|
||||
std::string expected8 = "-->" + std::string((const char *)expected_utf8, sizeof(expected_utf8));
|
||||
|
@ -1925,7 +1922,6 @@ UnicodeStringTest::TestUTF8() {
|
|||
if(result8r != expected8 || &result8r != &result8) {
|
||||
errln("UnicodeString::toUTF8String() did not create the expected string.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Test if this compiler supports Return Value Optimization of unnamed temporary objects.
|
||||
|
|
|
@ -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<std::string> 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if U_HAVE_STD_STRING
|
||||
#include <vector>
|
||||
#endif
|
||||
#include "unicode/errorcode.h"
|
||||
#include "unicode/localpointer.h"
|
||||
#include "unicode/putil.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "putilimp.h"
|
||||
|
||||
#if U_HAVE_POPEN
|
||||
#if (U_PF_MINGW <= U_PLATFORM || U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
|
||||
#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
|
||||
/* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */
|
||||
#undef __STRICT_ANSI__
|
||||
#endif
|
||||
|
|
|
@ -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 <set>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -785,5 +751,3 @@ U_CAPI void udbg_knownIssue_close(void *ptr) {
|
|||
KnownIssues *t = static_cast<KnownIssues*>(ptr);
|
||||
delete t;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue