Patch from GM: locale.cpp; make implicit conversions to bool explicit, fix some 'unknown pragma' warnings when compiling under MSVC, and don't use the __sso_allocator under windows, b/c MSVC doesn't support aligned-by value parameters
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@193086 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,7 +38,9 @@
|
|||||||
|
|
||||||
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
|
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
|
||||||
// lots of noise in the build log, but no bugs that I know of.
|
// lots of noise in the build log, but no bugs that I know of.
|
||||||
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic ignored "-Wsign-conversion"
|
#pragma clang diagnostic ignored "-Wsign-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -123,14 +125,23 @@ const locale::category locale::time;
|
|||||||
const locale::category locale::messages;
|
const locale::category locale::messages;
|
||||||
const locale::category locale::all;
|
const locale::category locale::all;
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wpadded"
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
#endif
|
||||||
|
|
||||||
class _LIBCPP_HIDDEN locale::__imp
|
class _LIBCPP_HIDDEN locale::__imp
|
||||||
: public facet
|
: public facet
|
||||||
{
|
{
|
||||||
enum {N = 28};
|
enum {N = 28};
|
||||||
|
#if defined(_LIBCPP_MSVC)
|
||||||
|
// FIXME: MSVC doesn't support aligned parameters by value.
|
||||||
|
// I can't get the __sso_allocator to work here
|
||||||
|
// for MSVC I think for this reason.
|
||||||
|
vector<facet*> facets_;
|
||||||
|
#else
|
||||||
vector<facet*, __sso_allocator<facet*, N> > facets_;
|
vector<facet*, __sso_allocator<facet*, N> > facets_;
|
||||||
|
#endif
|
||||||
string name_;
|
string name_;
|
||||||
public:
|
public:
|
||||||
explicit __imp(size_t refs = 0);
|
explicit __imp(size_t refs = 0);
|
||||||
@@ -154,7 +165,9 @@ private:
|
|||||||
template <class F> void install_from(const __imp& other);
|
template <class F> void install_from(const __imp& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
locale::__imp::__imp(size_t refs)
|
locale::__imp::__imp(size_t refs)
|
||||||
: facet(refs),
|
: facet(refs),
|
||||||
@@ -764,7 +777,7 @@ ctype<wchar_t>::~ctype()
|
|||||||
bool
|
bool
|
||||||
ctype<wchar_t>::do_is(mask m, char_type c) const
|
ctype<wchar_t>::do_is(mask m, char_type c) const
|
||||||
{
|
{
|
||||||
return isascii(c) ? ctype<char>::classic_table()[c] & m : false;
|
return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t*
|
const wchar_t*
|
||||||
@@ -4359,7 +4372,7 @@ __num_put_base::__format_float(char* __fmtp, const char* __len,
|
|||||||
if (__flags & ios_base::showpoint)
|
if (__flags & ios_base::showpoint)
|
||||||
*__fmtp++ = '#';
|
*__fmtp++ = '#';
|
||||||
ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
|
ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
|
||||||
bool uppercase = __flags & ios_base::uppercase;
|
bool uppercase = (__flags & ios_base::uppercase) != 0;
|
||||||
if (floatfield == (ios_base::fixed | ios_base::scientific))
|
if (floatfield == (ios_base::fixed | ios_base::scientific))
|
||||||
specify_precision = false;
|
specify_precision = false;
|
||||||
else
|
else
|
||||||
@@ -4690,9 +4703,12 @@ __time_get::~__time_get()
|
|||||||
{
|
{
|
||||||
freelocale(__loc_);
|
freelocale(__loc_);
|
||||||
}
|
}
|
||||||
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
|
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
#endif
|
||||||
|
#if defined(__GNUG__)
|
||||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||||
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
string
|
string
|
||||||
@@ -4838,7 +4854,9 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic ignored "-Wmissing-braces"
|
#pragma clang diagnostic ignored "-Wmissing-braces"
|
||||||
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
wstring
|
wstring
|
||||||
|
Reference in New Issue
Block a user