Fix undefined macro issue in locale tests; Try 2
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -52,9 +52,10 @@ public:
|
|||||||
// this function converts the spaces in string inputs to that character if need
|
// this function converts the spaces in string inputs to that character if need
|
||||||
// be.
|
// be.
|
||||||
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
||||||
#if !defined(TEST_HAS_GLIBC) || !TEST_GLIBC_PREREQ(2,27)
|
#ifndef TEST_GLIBC_PREREQ
|
||||||
return in;
|
#define TEST_GLIBC_PREREQ(x, y) 0
|
||||||
#else
|
#endif
|
||||||
|
#if TEST_GLIBC_PREREQ(2,27)
|
||||||
std::wstring out;
|
std::wstring out;
|
||||||
unsigned I = 0;
|
unsigned I = 0;
|
||||||
bool seen_decimal = false;
|
bool seen_decimal = false;
|
||||||
@@ -68,6 +69,8 @@ static std::wstring convert_thousands_sep(std::wstring const& in) {
|
|||||||
out.push_back(L'\u202F');
|
out.push_back(L'\u202F');
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
#else
|
||||||
|
return in;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,10 @@ public:
|
|||||||
// this function converts the spaces in string inputs to that character if need
|
// this function converts the spaces in string inputs to that character if need
|
||||||
// be.
|
// be.
|
||||||
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
||||||
#if !defined(TEST_HAS_GLIBC) || !TEST_GLIBC_PREREQ(2,27)
|
#ifndef TEST_GLIBC_PREREQ
|
||||||
return in;
|
#define TEST_GLIBC_PREREQ(x, y) 0
|
||||||
#else
|
#endif
|
||||||
|
#if TEST_GLIBC_PREREQ(2,27)
|
||||||
std::wstring out;
|
std::wstring out;
|
||||||
unsigned I = 0;
|
unsigned I = 0;
|
||||||
bool seen_num_start = false;
|
bool seen_num_start = false;
|
||||||
@@ -70,6 +71,8 @@ static std::wstring convert_thousands_sep(std::wstring const& in) {
|
|||||||
out.push_back(L'\u202F');
|
out.push_back(L'\u202F');
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
#else
|
||||||
|
return in;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ int main()
|
|||||||
assert(f.thousands_sep() == ' ');
|
assert(f.thousands_sep() == ' ');
|
||||||
}
|
}
|
||||||
// The below tests work around GLIBC's use of U202F as mon_thousands_sep.
|
// The below tests work around GLIBC's use of U202F as mon_thousands_sep.
|
||||||
|
#ifndef TEST_GLIBC_PREREQ
|
||||||
|
#define TEST_GLIBC_PREREQ(x, y) 0
|
||||||
|
#endif
|
||||||
#if defined(TEST_HAS_GLIBC) && TEST_GLIBC_PREREQ(2, 27)
|
#if defined(TEST_HAS_GLIBC) && TEST_GLIBC_PREREQ(2, 27)
|
||||||
const wchar_t fr_sep = L'\u202F';
|
const wchar_t fr_sep = L'\u202F';
|
||||||
#else
|
#else
|
||||||
@@ -118,9 +121,6 @@ int main()
|
|||||||
// and U002E as mon_decimal_point.
|
// and U002E as mon_decimal_point.
|
||||||
// TODO: Fix thousands_sep for 'char'.
|
// TODO: Fix thousands_sep for 'char'.
|
||||||
// related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
|
// related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
|
||||||
#ifndef TEST_GLIBC_PREREQ
|
|
||||||
#define TEST_GLIBC_PREREQ(x, y) 0
|
|
||||||
#endif
|
|
||||||
#ifndef TEST_HAS_GLIBC
|
#ifndef TEST_HAS_GLIBC
|
||||||
const char sep = ' ';
|
const char sep = ' ';
|
||||||
const wchar_t wsep = L' ';
|
const wchar_t wsep = L' ';
|
||||||
|
|||||||
Reference in New Issue
Block a user