Fix undefined macro issue in locale tests; Try 2
llvm-svn: 329149
This commit is contained in:
parent
06091cfa7a
commit
c18fe4cf41
|
@ -52,9 +52,10 @@ public:
|
|||
// this function converts the spaces in string inputs to that character if need
|
||||
// be.
|
||||
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
||||
#if !defined(TEST_HAS_GLIBC) || !TEST_GLIBC_PREREQ(2,27)
|
||||
return in;
|
||||
#else
|
||||
#ifndef TEST_GLIBC_PREREQ
|
||||
#define TEST_GLIBC_PREREQ(x, y) 0
|
||||
#endif
|
||||
#if TEST_GLIBC_PREREQ(2,27)
|
||||
std::wstring out;
|
||||
unsigned I = 0;
|
||||
bool seen_decimal = false;
|
||||
|
@ -68,6 +69,8 @@ static std::wstring convert_thousands_sep(std::wstring const& in) {
|
|||
out.push_back(L'\u202F');
|
||||
}
|
||||
return out;
|
||||
#else
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,10 @@ public:
|
|||
// this function converts the spaces in string inputs to that character if need
|
||||
// be.
|
||||
static std::wstring convert_thousands_sep(std::wstring const& in) {
|
||||
#if !defined(TEST_HAS_GLIBC) || !TEST_GLIBC_PREREQ(2,27)
|
||||
return in;
|
||||
#else
|
||||
#ifndef TEST_GLIBC_PREREQ
|
||||
#define TEST_GLIBC_PREREQ(x, y) 0
|
||||
#endif
|
||||
#if TEST_GLIBC_PREREQ(2,27)
|
||||
std::wstring out;
|
||||
unsigned I = 0;
|
||||
bool seen_num_start = false;
|
||||
|
@ -70,6 +71,8 @@ static std::wstring convert_thousands_sep(std::wstring const& in) {
|
|||
out.push_back(L'\u202F');
|
||||
}
|
||||
return out;
|
||||
#else
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,9 @@ int main()
|
|||
assert(f.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)
|
||||
const wchar_t fr_sep = L'\u202F';
|
||||
#else
|
||||
|
@ -118,9 +121,6 @@ int main()
|
|||
// and U002E as mon_decimal_point.
|
||||
// TODO: Fix thousands_sep for 'char'.
|
||||
// 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
|
||||
const char sep = ' ';
|
||||
const wchar_t wsep = L' ';
|
||||
|
|
Loading…
Reference in New Issue