From a36451371c101fbaf1efd61f66ec2a0721974085 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 21 Oct 2013 15:07:28 +0000 Subject: [PATCH] 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 --- src/locale.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/locale.cpp b/src/locale.cpp index 43603f0f..8fadbb6f 100644 --- a/src/locale.cpp +++ b/src/locale.cpp @@ -38,7 +38,9 @@ // 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. +#if defined(__clang__) #pragma clang diagnostic ignored "-Wsign-conversion" +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -123,14 +125,23 @@ const locale::category locale::time; const locale::category locale::messages; const locale::category locale::all; +#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" +#endif class _LIBCPP_HIDDEN locale::__imp : public facet { 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 facets_; +#else vector > facets_; +#endif string name_; public: explicit __imp(size_t refs = 0); @@ -154,7 +165,9 @@ private: template void install_from(const __imp& other); }; +#if defined(__clang__) #pragma clang diagnostic pop +#endif locale::__imp::__imp(size_t refs) : facet(refs), @@ -764,7 +777,7 @@ ctype::~ctype() bool ctype::do_is(mask m, char_type c) const { - return isascii(c) ? ctype::classic_table()[c] & m : false; + return isascii(c) ? (ctype::classic_table()[c] & m) != 0 : false; } const wchar_t* @@ -4359,7 +4372,7 @@ __num_put_base::__format_float(char* __fmtp, const char* __len, if (__flags & ios_base::showpoint) *__fmtp++ = '#'; 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)) specify_precision = false; else @@ -4690,9 +4703,12 @@ __time_get::~__time_get() { freelocale(__loc_); } - +#if defined(__clang__) #pragma clang diagnostic ignored "-Wmissing-field-initializers" +#endif +#if defined(__GNUG__) #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif template <> string @@ -4838,7 +4854,9 @@ __time_get_storage::__analyze(char fmt, const ctype& ct) return result; } +#if defined(__clang__) #pragma clang diagnostic ignored "-Wmissing-braces" +#endif template <> wstring