Quash a whole bunch of warnings

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145624 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2011-12-01 20:21:04 +00:00
parent 9996844df0
commit ec3773c2da
40 changed files with 380 additions and 322 deletions

View File

@@ -637,7 +637,7 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
{ {
__m = ~__storage_type(0) << (__bits_per_word - __n); __m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m; __storage_type __b = *--__last.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_; __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_)); __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m; *__result.__seg_ &= ~__m;
@@ -881,7 +881,6 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
typedef __bit_iterator<_Cp, false> _I1; typedef __bit_iterator<_Cp, false> _I1;
typedef typename _I1::difference_type difference_type; typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type; typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
difference_type __d1 = __middle - __first; difference_type __d1 = __middle - __first;
difference_type __d2 = __last - __middle; difference_type __d2 = __last - __middle;
_I1 __r = __first + __d2; _I1 __r = __first + __d2;

View File

@@ -411,13 +411,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t) = delete; template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&& __t) = delete; template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t);// = delete; template <class _Tp> void ref(const _Tp&&);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete; template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS

View File

@@ -723,7 +723,7 @@ private:
__node_traits::propagate_on_container_copy_assignment::value>());} __node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type); void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u, false_type) {} void __copy_assign_alloc(const __hash_table&, false_type) {}
void __move_assign(__hash_table& __u, false_type); void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type) void __move_assign(__hash_table& __u, true_type)
@@ -782,7 +782,7 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static static
void void
__swap_alloc(_Ap& __x, _Ap& __y, false_type) _NOEXCEPT {} __swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
void __deallocate(__node_pointer __np) _NOEXCEPT; void __deallocate(__node_pointer __np) _NOEXCEPT;
__node_pointer __detach() _NOEXCEPT; __node_pointer __detach() _NOEXCEPT;

View File

@@ -240,7 +240,7 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
const size_t __mask = size_t(0xF) << (__sr + 4); const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p) for(const char_type* __p = __lo; __p != __hi; ++__p)
{ {
__h = (__h << 4) + *__p; __h = (__h << 4) + static_cast<size_t>(*__p);
size_t __g = __h & __mask; size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr); __h ^= __g | (__g >> __sr);
} }
@@ -485,14 +485,14 @@ public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const bool is(mask __m, char_type __c) const
{ {
return isascii(__c) ? __tab_[__c] & __m : false; return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false;
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{ {
for (; __low != __high; ++__low, ++__vec) for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[*__low] : 0; *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
return __low; return __low;
} }
@@ -500,7 +500,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[*__low] & __m)) if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
break; break;
return __low; return __low;
} }
@@ -509,7 +509,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[*__low] & __m))) if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
break; break;
return __low; return __low;
} }

View File

@@ -152,7 +152,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -171,7 +171,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
{} {}
}; };
@@ -490,7 +490,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -521,7 +521,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -554,7 +554,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -585,7 +585,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -618,7 +618,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
} }
else else
{ {
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));

View File

@@ -25,7 +25,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
static const unsigned __limit = 8; static const int __limit = 8;
// __stdinbuf // __stdinbuf
@@ -104,7 +104,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
int __nread = _VSTD::max(1, __encoding_); int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i) for (int __i = 0; __i < __nread; ++__i)
{ {
char __c = getc(__file_); int __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c); __extbuf[__i] = static_cast<char>(__c);
@@ -131,7 +131,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
if (__nread == sizeof(__extbuf)) if (__nread == sizeof(__extbuf))
return traits_type::eof(); return traits_type::eof();
{ {
char __c = getc(__file_); int __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c); __extbuf[__nread] = static_cast<char>(__c);
@@ -268,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial) if (__r == codecvt_base::partial)
{ {
this->setp((char_type*)__e, this->pptr()); this->setp((char_type*)__e, this->pptr());
this->pbump(this->epptr() - this->pbase()); this->pbump(static_cast<int>(this->epptr() - this->pbase()));
} }
} }
else else

View File

@@ -65,7 +65,7 @@ public:
}; };
template <class ..._Tp> class _LIBCPP_VISIBLE tuple; template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair; template <class _T1, class _T2> struct _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array; template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {}; template <class _Tp> struct __tuple_like : false_type {};

View File

@@ -697,14 +697,48 @@ struct __debug_less
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
// Precondition: __x != 0 // Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);} inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY unsigned long __ctz(unsigned long __x) {return __builtin_ctzl (__x);} unsigned
inline _LIBCPP_INLINE_VISIBILITY unsigned long long __ctz(unsigned long long __x) {return __builtin_ctzll(__x);} __ctz(unsigned __x)
{
return static_cast<unsigned>(__builtin_ctz(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long
__ctz(unsigned long __x)
{
return static_cast<unsigned long>(__builtin_ctzl(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long long
__ctz(unsigned long long __x)
{
return static_cast<unsigned long long>(__builtin_ctzll(__x));
}
// Precondition: __x != 0 // Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY unsigned __clz(unsigned __x) {return __builtin_clz (__x);} inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY unsigned long __clz(unsigned long __x) {return __builtin_clzl (__x);} unsigned
inline _LIBCPP_INLINE_VISIBILITY unsigned long long __clz(unsigned long long __x) {return __builtin_clzll(__x);} __clz(unsigned __x)
{
return static_cast<unsigned>(__builtin_clz(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long
__clz(unsigned long __x)
{
return static_cast<unsigned long>(__builtin_clzl (__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long long
__clz(unsigned long long __x)
{
return static_cast<unsigned long long>(__builtin_clzll(__x));
}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
@@ -2678,8 +2712,8 @@ public:
result_type operator()(); result_type operator()();
static const/*expr*/ result_type min() {return _Min;} static constexpr result_type min() {return _Min;}
static const/*expr*/ result_type max() {return _Max;} static constexpr result_type max() {return _Max;}
friend __rs_default __rs_get(); friend __rs_default __rs_get();
}; };
@@ -3721,7 +3755,7 @@ extern template bool __insertion_sort_incomplete<__less<long double>&, long doub
extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning( pop ) #pragma warning( pop )
#endif _MSC_VER #endif // _MSC_VER
// lower_bound // lower_bound

View File

@@ -213,7 +213,7 @@ __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
{ {
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word) for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
@@ -226,7 +226,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
{ {
__first_[0] = __v; __first_[0] = __v;
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
@@ -560,7 +560,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>; friend struct __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference; typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference; typedef __bit_const_reference<__bitset> const_reference;
@@ -574,9 +574,9 @@ protected:
{return reference(0, 1);} {return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);} {return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
{return iterator(0, 0);} {return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
{return const_iterator(0, 0);} {return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}

View File

@@ -1600,7 +1600,7 @@ using ::acoshl;
using ::asinhl; using ::asinhl;
using ::atanhl; using ::atanhl;
using ::cbrtl; using ::cbrtl;
#endif !_MSC_VER #endif // !_MSC_VER
using ::copysignl; using ::copysignl;
#ifndef _MSC_VER #ifndef _MSC_VER
using ::erfl; using ::erfl;

View File

@@ -988,7 +988,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -1007,7 +1007,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) static void __swap_alloc(allocator_type&, allocator_type&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
}; };
@@ -1403,7 +1403,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, false_type) void __copy_assign_alloc(const deque&, false_type)
{} {}
void __move_assign(deque& __c, true_type) void __move_assign(deque& __c, true_type)

View File

@@ -239,7 +239,7 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
template <class _Ep> template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep& __e, typename enable_if< rethrow_if_nested(const _Ep&, typename enable_if<
!is_polymorphic<_Ep>::value !is_polymorphic<_Ep>::value
>::type* = 0) >::type* = 0)
{ {

View File

@@ -1573,7 +1573,7 @@ typename enable_if
!__is_reference_wrapper<_Ti>::value, !__is_reference_wrapper<_Ti>::value,
_Ti& _Ti&
>::type >::type
__mu(_Ti& __ti, _Uj& __uj) __mu(_Ti& __ti, _Uj&)
{ {
return __ti; return __ti;
} }

View File

@@ -1145,7 +1145,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
} }
++__gc_; ++__gc_;
char_type __ch = traits_type::to_char_type(__i); char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
@@ -1161,7 +1161,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
} }
++__gc_; ++__gc_;
char_type __ch = traits_type::to_char_type(__i); char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
@@ -1212,7 +1212,6 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
ios_base::iostate __err = ios_base::goodbit;
for (; __gc_ < __n; ++__gc_) for (; __gc_ < __n; ++__gc_)
{ {
typename traits_type::int_type __i = this->rdbuf()->sbumpc(); typename traits_type::int_type __i = this->rdbuf()->sbumpc();

View File

@@ -823,7 +823,8 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {} : __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();} _LIBCPP_INLINE_VISIBILITY char_type operator*() const
{return static_cast<char_type>(__sbuf_->sgetc());}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{ {

View File

@@ -433,7 +433,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
bool __case_sensitive = true) bool __case_sensitive = true)
{ {
typedef typename iterator_traits<_InputIterator>::value_type _CharT; typedef typename iterator_traits<_InputIterator>::value_type _CharT;
size_t __nkw = _VSTD::distance(__kb, __ke); size_t __nkw = static_cast<size_t>(_VSTD::distance(__kb, __ke));
const unsigned char __doesnt_match = '\0'; const unsigned char __doesnt_match = '\0';
const unsigned char __might_match = '\1'; const unsigned char __might_match = '\1';
const unsigned char __does_match = '\2'; const unsigned char __does_match = '\2';
@@ -598,7 +598,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
__dc = 0; __dc = 0;
return 0; return 0;
} }
if (__ct == __thousands_sep && __grouping.size() != 0) if (__grouping.size() != 0 && __ct == __thousands_sep)
{ {
if (__g_end-__g < __num_get_buf_sz) if (__g_end-__g < __num_get_buf_sz)
{ {
@@ -681,8 +681,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
return 0; return 0;
} }
extern template class __num_get<char>; extern template struct __num_get<char>;
extern template class __num_get<wchar_t>; extern template struct __num_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_get class _LIBCPP_VISIBLE num_get
@@ -1275,7 +1275,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
int __base = 16; int __base = 16;
// Stage 2 // Stage 2
char_type __atoms[26]; char_type __atoms[26];
char_type __thousands_sep; char_type __thousands_sep = 0;
string __grouping; string __grouping;
use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
__num_get_base::__src + 26, __atoms); __num_get_base::__src + 26, __atoms);
@@ -1453,8 +1453,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
__op = __ob + (__np - __nb); __op = __ob + (__np - __nb);
} }
extern template class __num_put<char>; extern template struct __num_put<char>;
extern template class __num_put<wchar_t>; extern template struct __num_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_put class _LIBCPP_VISIBLE num_put
@@ -1766,7 +1766,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
unique_ptr<char_type, void(*)(void*)> __obh(0, free); unique_ptr<char_type, void(*)(void*)> __obh(0, free);
if (__nb != __nar) if (__nb != __nar)
{ {
__ob = (char_type*)malloc((2*__nc)*sizeof(char_type)); __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
if (__ob == 0) if (__ob == 0)
__throw_bad_alloc(); __throw_bad_alloc();
__obh.reset(__ob); __obh.reset(__ob);
@@ -1835,7 +1835,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
unique_ptr<char_type, void(*)(void*)> __obh(0, free); unique_ptr<char_type, void(*)(void*)> __obh(0, free);
if (__nb != __nar) if (__nb != __nar)
{ {
__ob = (char_type*)malloc((2*__nc)*sizeof(char_type)); __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
if (__ob == 0) if (__ob == 0)
__throw_bad_alloc(); __throw_bad_alloc();
__obh.reset(__ob); __obh.reset(__ob);
@@ -2102,7 +2102,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
{ {
// Note: ignoring case comes from the POSIX strptime spec // Note: ignoring case comes from the POSIX strptime spec
const string_type* __wk = this->__weeks(); const string_type* __wk = this->__weeks();
int __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
if (__i < 14) if (__i < 14)
__w = __i % 7; __w = __i % 7;
} }
@@ -2116,7 +2116,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
{ {
// Note: ignoring case comes from the POSIX strptime spec // Note: ignoring case comes from the POSIX strptime spec
const string_type* __month = this->__months(); const string_type* __month = this->__months();
int __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
if (__i < 24) if (__i < 24)
__m = __i % 12; __m = __i % 12;
} }
@@ -2288,7 +2288,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
__err |= ios_base::failbit; __err |= ios_base::failbit;
return; return;
} }
int __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
if (__i == 0 && __h == 12) if (__i == 0 && __h == 12)
__h = 0; __h = 0;
else if (__i == 1 && __h < 12) else if (__i == 1 && __h < 12)
@@ -2397,7 +2397,6 @@ time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
ios_base::iostate& __err, ios_base::iostate& __err,
tm* __tm) const tm* __tm) const
{ {
const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
const string_type& __fmt = this->__x(); const string_type& __fmt = this->__x();
return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
} }
@@ -2460,8 +2459,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break; break;
case 'c': case 'c':
{ {
const string_type& __fmt = this->__c(); const string_type& __fm = this->__c();
__b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
} }
break; break;
case 'd': case 'd':
@@ -2470,14 +2469,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break; break;
case 'D': case 'D':
{ {
const char_type __fmt[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
} }
break; break;
case 'F': case 'F':
{ {
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
} }
break; break;
case 'H': case 'H':
@@ -2504,14 +2503,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break; break;
case 'r': case 'r':
{ {
const char_type __fmt[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
} }
break; break;
case 'R': case 'R':
{ {
const char_type __fmt[] = {'%', 'H', ':', '%', 'M'}; const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
} }
break; break;
case 'S': case 'S':
@@ -2519,8 +2518,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break; break;
case 'T': case 'T':
{ {
const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
} }
break; break;
case 'w': case 'w':
@@ -2530,8 +2529,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
return do_get_date(__b, __e, __iob, __err, __tm); return do_get_date(__b, __e, __iob, __err, __tm);
case 'X': case 'X':
{ {
const string_type& __fmt = this->__X(); const string_type& __fm = this->__X();
__b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
} }
break; break;
case 'y': case 'y':
@@ -2734,7 +2733,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
template <class _CharT, class _OutputIterator> template <class _CharT, class _OutputIterator>
_OutputIterator _OutputIterator
time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
char_type, const tm* __tm, char_type, const tm* __tm,
char __fmt, char __mod) const char __fmt, char __mod) const
{ {
@@ -3011,10 +3010,10 @@ void
__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
{ {
bool __owns = __b.get_deleter() != __do_nothing; bool __owns = __b.get_deleter() != __do_nothing;
size_t __cur_cap = (__e-__b.get()) * sizeof(_Tp); size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ? size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
2 * __cur_cap : numeric_limits<size_t>::max(); 2 * __cur_cap : numeric_limits<size_t>::max();
size_t __n_off = __n - __b.get(); size_t __n_off = static_cast<size_t>(__n - __b.get());
_Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
if (__t == 0) if (__t == 0)
__throw_bad_alloc(); __throw_bad_alloc();
@@ -3232,7 +3231,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
ios_base::iostate& __err, ios_base::iostate& __err,
long double& __v) const long double& __v) const
{ {
const unsigned __bz = 100; const int __bz = 100;
char_type __wbuf[__bz]; char_type __wbuf[__bz];
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing); unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
char_type* __wn; char_type* __wn;
@@ -3251,7 +3250,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unique_ptr<char, void(*)(void*)> __h(0, free); unique_ptr<char, void(*)(void*)> __h(0, free);
if (__wn - __wb.get() > __bz-2) if (__wn - __wb.get() > __bz-2)
{ {
__h.reset((char*)malloc(__wn - __wb.get() + 2)); __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
if (__h.get() == 0) if (__h.get() == 0)
__throw_bad_alloc(); __throw_bad_alloc();
__nc = __h.get(); __nc = __h.get();
@@ -3276,7 +3275,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
ios_base::iostate& __err, ios_base::iostate& __err,
string_type& __v) const string_type& __v) const
{ {
const unsigned __bz = 100; const int __bz = 100;
char_type __wbuf[__bz]; char_type __wbuf[__bz];
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing); unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
char_type* __wn; char_type* __wn;
@@ -3536,14 +3535,14 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char* __bb = __buf; char* __bb = __buf;
char_type __digits[__bs]; char_type __digits[__bs];
char_type* __db = __digits; char_type* __db = __digits;
size_t __n = snprintf(__bb, __bs, "%.0Lf", __units); size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
unique_ptr<char, void(*)(void*)> __hn(0, free); unique_ptr<char, void(*)(void*)> __hn(0, free);
unique_ptr<char_type, void(*)(void*)> __hd(0, free); unique_ptr<char_type, void(*)(void*)> __hd(0, free);
// secure memory for digit storage // secure memory for digit storage
if (__n > __bs-1) if (__n > __bs-1)
{ {
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
__n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units); __n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
#else #else
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units); __n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
#endif #endif
@@ -3573,8 +3572,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char_type* __mb = __mbuf; char_type* __mb = __mbuf;
unique_ptr<char_type, void(*)(void*)> __hw(0, free); unique_ptr<char_type, void(*)(void*)> __hw(0, free);
size_t __exn = static_cast<int>(__n) > __fd ? size_t __exn = static_cast<int>(__n) > __fd ?
(__n - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1 (__n - static_cast<size_t>(__fd)) * 2 + __sn.size() +
: __sn.size() + __sym.size() + __fd + 2; __sym.size() + static_cast<size_t>(__fd) + 1
: __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
if (__exn > __bs) if (__exn > __bs)
{ {
__hw.reset((char_type*)malloc(__exn * sizeof(char_type))); __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
@@ -3613,9 +3613,10 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char_type __mbuf[100]; char_type __mbuf[100];
char_type* __mb = __mbuf; char_type* __mb = __mbuf;
unique_ptr<char_type, void(*)(void*)> __h(0, free); unique_ptr<char_type, void(*)(void*)> __h(0, free);
size_t __exn = __digits.size() > __fd ? size_t __exn = static_cast<int>(__digits.size()) > __fd ?
(__digits.size() - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1 (__digits.size() - static_cast<size_t>(__fd)) * 2 +
: __sn.size() + __sym.size() + __fd + 2; __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
: __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
if (__exn > 100) if (__exn > 100)
{ {
__h.reset((char_type*)malloc(__exn * sizeof(char_type))); __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
@@ -4005,9 +4006,9 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
} }
else if (__r == codecvt_base::partial) else if (__r == codecvt_base::partial)
{ {
ptrdiff_t __s = __to_nxt - &__bs[0]; ptrdiff_t __sp = __to_nxt - &__bs[0];
__bs.resize(2 * __s); __bs.resize(2 * __sp);
__to = &__bs[0] + __s; __to = &__bs[0] + __sp;
__to_end = &__bs[0] + __bs.size(); __to_end = &__bs[0] + __bs.size();
} }
} while (__r == codecvt_base::partial); } while (__r == codecvt_base::partial);

View File

@@ -1526,7 +1526,7 @@ private:
{return __a.allocate(__n, __hint);} {return __a.allocate(__n, __hint);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n, static pointer allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, false_type) const_void_pointer, false_type)
{return __a.allocate(__n);} {return __a.allocate(__n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2181,7 +2181,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;}
_LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
_LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&)
_NOEXCEPT_(__is_nothrow_swappable<_T1>::value && _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
__is_nothrow_swappable<_T1>::value) __is_nothrow_swappable<_T1>::value)
{ {
@@ -3099,7 +3099,7 @@ public:
void swap(shared_ptr& __r) _NOEXCEPT; void swap(shared_ptr& __r) _NOEXCEPT;
void reset() _NOEXCEPT; void reset() _NOEXCEPT;
template<class _Yp> void reset(_Yp* __p) _NOEXCEPT; template<class _Yp> void reset(_Yp* __p);
template<class _Yp, class _Dp> void reset(_Yp* __p, _Dp __d); template<class _Yp, class _Dp> void reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc> void reset(_Yp* __p, _Dp __d, _Alloc __a); template<class _Yp, class _Dp, class _Alloc> void reset(_Yp* __p, _Dp __d, _Alloc __a);

View File

@@ -534,7 +534,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{ {
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul) if (__flag.__state_ != ~0ul)
{ {
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp; typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)), __call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),

View File

@@ -1860,8 +1860,9 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit linear_congruential_engine(result_type __s = default_seed) explicit linear_congruential_engine(result_type __s = default_seed)
{seed(__s);} {seed(__s);}
template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q, template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit linear_congruential_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0) typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
{seed(__q);} {seed(__q);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -2116,8 +2117,9 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit mersenne_twister_engine(result_type __sd = default_seed) explicit mersenne_twister_engine(result_type __sd = default_seed)
{seed(__sd);} {seed(__sd);}
template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q, template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit mersenne_twister_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0) typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
{seed(__q);} {seed(__q);}
void seed(result_type __sd = default_seed); void seed(result_type __sd = default_seed);
@@ -2200,7 +2202,7 @@ private:
(__count >= __w), (__count >= __w),
result_type result_type
>::type >::type
__lshift(result_type __x) {return result_type(0);} __lshift(result_type) {return result_type(0);}
template <size_t __count> template <size_t __count>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -2220,7 +2222,7 @@ private:
(__count >= _Dt), (__count >= _Dt),
result_type result_type
>::type >::type
__rshift(result_type __x) {return result_type(0);} __rshift(result_type) {return result_type(0);}
}; };
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r, template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2485,8 +2487,9 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit subtract_with_carry_engine(result_type __sd = default_seed) explicit subtract_with_carry_engine(result_type __sd = default_seed)
{seed(__sd);} {seed(__sd);}
template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q, template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit subtract_with_carry_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0) typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
{seed(__q);} {seed(__q);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -2955,8 +2958,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
template<class _Sseq> explicit independent_bits_engine(_Sseq& __q, template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value && typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0) !is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {} : __e_(__q) {}
@@ -3033,7 +3037,7 @@ private:
(__count >= _Dt), (__count >= _Dt),
result_type result_type
>::type >::type
__lshift(result_type __x) {return result_type(0);} __lshift(result_type) {return result_type(0);}
}; };
template<class _Engine, size_t __w, class _UIntType> template<class _Engine, size_t __w, class _UIntType>
@@ -3178,8 +3182,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q, template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value && typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0) !is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {__init();} : __e_(__q) {__init();}
@@ -3369,9 +3374,9 @@ public:
static const result_type _Max = 0xFFFFFFFFu; static const result_type _Max = 0xFFFFFFFFu;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static const/*expr*/ result_type min() { return _Min;} static constexpr result_type min() { return _Min;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static const/*expr*/ result_type max() { return _Max;} static constexpr result_type max() { return _Max;}
// constructors // constructors
explicit random_device(const string& __token = "/dev/urandom"); explicit random_device(const string& __token = "/dev/urandom");

View File

@@ -4404,7 +4404,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + __hd; __sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first; ++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last) if (__first == __last)
@@ -4415,7 +4415,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + __hd; __sum = 16 * __sum + static_cast<unsigned>(__hd);
// drop through // drop through
case 'x': case 'x':
++__first; ++__first;
@@ -4428,7 +4428,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + __hd; __sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first; ++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last) if (__first == __last)
@@ -4439,7 +4439,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + __hd; __sum = 16 * __sum + static_cast<unsigned>(__hd);
if (__str) if (__str)
*__str = _CharT(__sum); *__str = _CharT(__sum);
else else
@@ -5496,8 +5496,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
regex_constants::match_flag_type __flags, bool __at_first) const regex_constants::match_flag_type __flags, bool __at_first) const
{ {
vector<__state> __states; vector<__state> __states;
ptrdiff_t __j = 0;
ptrdiff_t _Np = _VSTD::distance(__first, __last);
__node* __st = __start_.get(); __node* __st = __start_.get();
if (__st) if (__st)
{ {
@@ -5511,7 +5509,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__node_ = __st; __states.back().__node_ = __st;
__states.back().__flags_ = __flags; __states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first; __states.back().__at_first_ = __at_first;
bool __matched = false;
do do
{ {
__state& __s = __states.back(); __state& __s = __states.back();

View File

@@ -461,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
ios_base::openmode __which) ios_base::openmode)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which) basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
@@ -548,7 +548,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::overflow(int_type __c) basic_streambuf<_CharT, _Traits>::overflow(int_type)
{ {
return traits_type::eof(); return traits_type::eof();
} }

View File

@@ -1079,7 +1079,7 @@ private:
enum {__long_mask = ~(size_type(~0) >> 1)}; enum {__long_mask = ~(size_type(~0) >> 1)};
#else // _LIBCPP_BIG_ENDIAN #else // _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x01}; enum {__short_mask = 0x01};
enum {__long_mask = 0x1}; enum {__long_mask = 0x1ul};
#endif // _LIBCPP_BIG_ENDIAN #endif // _LIBCPP_BIG_ENDIAN
enum {__mask = size_type(~0) >> 1}; enum {__mask = size_type(~0) >> 1};
@@ -1501,7 +1501,7 @@ private:
{__r_.first().__l.__cap_ = __long_mask | __s;} {__r_.first().__l.__cap_ = __long_mask | __s;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type __get_long_cap() const _NOEXCEPT size_type __get_long_cap() const _NOEXCEPT
{return __r_.first().__l.__cap_ & ~__long_mask;} {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __set_long_pointer(pointer __p) _NOEXCEPT void __set_long_pointer(pointer __p) _NOEXCEPT
@@ -1591,7 +1591,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
{} {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1619,7 +1619,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(basic_string& __c, false_type) void __move_assign_alloc(basic_string&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
@@ -1638,7 +1638,7 @@ private:
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
@@ -1669,7 +1669,11 @@ template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
#endif #endif
void void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos) basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
#ifdef _LIBCPP_DEBUG
__pos
#endif
)
{ {
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
const_iterator __beg = begin(); const_iterator __beg = begin();
@@ -2785,7 +2789,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
iterator __b = begin(); iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b); size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1); erase(__r, 1);
return __b + __r; return __b + static_cast<difference_type>(__r);
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -2796,7 +2800,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
iterator __b = begin(); iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b); size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first)); erase(__r, static_cast<size_type>(__last - __first));
return __b + __r; return __b + static_cast<difference_type>(__r);
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -3483,7 +3487,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
int int
basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
{ {
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
assert(__s != 0); assert(__s != 0);

View File

@@ -474,7 +474,7 @@ bool
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value(); || (__x.category() == __y.category() && __x.value() < __y.value());
} }
// error_code // error_code
@@ -551,7 +551,7 @@ bool
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value(); || (__x.category() == __y.category() && __x.value() < __y.value());
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY

View File

@@ -195,13 +195,13 @@ public:
explicit __tuple_leaf(_Tp&& __t) explicit __tuple_leaf(_Tp&& __t)
: value(_VSTD::forward<_Tp>(__t)) : value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value || {static_assert(!is_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value || (is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type, is_same<typename remove_reference<_Tp>::type,
reference_wrapper< reference_wrapper<
typename remove_reference<_Hp>::type typename remove_reference<_Hp>::type
> >
>::value) || >::value)) ||
(is_rvalue_reference<_Hp>::value && (is_rvalue_reference<_Hp>::value &&
!is_lvalue_reference<_Tp>::value), !is_lvalue_reference<_Tp>::value),
"Attempted to construct a reference element in a tuple with an rvalue");} "Attempted to construct a reference element in a tuple with an rvalue");}
@@ -211,13 +211,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
: value(_VSTD::forward<_Tp>(__t)) : value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value || {static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value || (is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type, is_same<typename remove_reference<_Tp>::type,
reference_wrapper< reference_wrapper<
typename remove_reference<_Hp>::type typename remove_reference<_Hp>::type
> >
>::value), >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");} "Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
@@ -225,13 +225,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
: value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value || {static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value || (is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type, is_same<typename remove_reference<_Tp>::type,
reference_wrapper< reference_wrapper<
typename remove_reference<_Hp>::type typename remove_reference<_Hp>::type
> >
>::value), >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");} "Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
@@ -239,13 +239,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: value(_VSTD::forward<_Tp>(__t), __a) : value(_VSTD::forward<_Tp>(__t), __a)
{static_assert(!is_lvalue_reference<_Hp>::value || {static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value && (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value || (is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type, is_same<typename remove_reference<_Tp>::type,
reference_wrapper< reference_wrapper<
typename remove_reference<_Hp>::type typename remove_reference<_Hp>::type
> >
>::value), >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");} "Attempted to construct a reference element in a tuple with an rvalue");}
__tuple_leaf(const __tuple_leaf& __t) __tuple_leaf(const __tuple_leaf& __t)
@@ -453,11 +453,11 @@ class _LIBCPP_VISIBLE tuple
base base_; base base_;
template <size_t _Jp, class ..._Up> friend template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&); typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&); const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&); typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -603,7 +603,7 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type& typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>& __t) get(tuple<_Tp...>& __t) _NOEXCEPT
{ {
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
@@ -612,7 +612,7 @@ get(tuple<_Tp...>& __t)
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type& const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>& __t) get(const tuple<_Tp...>& __t) _NOEXCEPT
{ {
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get(); return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
@@ -621,7 +621,7 @@ get(const tuple<_Tp...>& __t)
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&& typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&& __t) get(tuple<_Tp...>&& __t) _NOEXCEPT
{ {
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>( return static_cast<type&&>(

View File

@@ -708,7 +708,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
result_type operator[](size_t __j) const result_type operator[](size_t __j) const
{ {
ptrdiff_t __i = static_cast<size_t>(__j); ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np; ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m); return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
} }
@@ -959,7 +959,7 @@ public:
void swap(valarray& __v); void swap(valarray& __v);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t size() const {return __end_ - __begin_;} size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
value_type sum() const; value_type sum() const;
value_type min() const; value_type min() const;
@@ -1897,7 +1897,7 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v) mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)), : __vp_(const_cast<value_type*>(__v.__begin_)),
__1d_(count(__vb.__begin_, __vb.__end_, true)) __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
{ {
size_t __j = 0; size_t __j = 0;
for (size_t __i = 0; __i < __vb.size(); ++__i) for (size_t __i = 0; __i < __vb.size(); ++__i)
@@ -2108,7 +2108,7 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__mask_expr(const valarray<bool>& __vb, const _RmExpr& __e) __mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
: __expr_(__e), : __expr_(__e),
__1d_(count(__vb.__begin_, __vb.__end_, true)) __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
{ {
size_t __j = 0; size_t __j = 0;
for (size_t __i = 0; __i < __vb.size(); ++__i) for (size_t __i = 0; __i < __vb.size(); ++__i)

View File

@@ -406,7 +406,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c, false_type) void __copy_assign_alloc(const __vector_base&, false_type)
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -417,7 +417,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__vector_base& __c, false_type) void __move_assign_alloc(__vector_base&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
@@ -429,7 +429,7 @@ private:
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) static void __swap_alloc(allocator_type&, allocator_type&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
}; };
@@ -2241,7 +2241,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __c, false_type) void __copy_assign_alloc(const vector&, false_type)
{} {}
void __move_assign(vector& __c, false_type); void __move_assign(vector& __c, false_type);
@@ -2262,7 +2262,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(vector& __c, false_type) void __move_assign_alloc(vector&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
@@ -2282,7 +2282,7 @@ private:
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, false_type) static void __swap_alloc(__storage_allocator&, __storage_allocator&, false_type)
_NOEXCEPT _NOEXCEPT
{} {}

View File

@@ -35,7 +35,9 @@ then
RC_ProjectSourceVersion=1 RC_ProjectSourceVersion=1
fi fi
EXTRA_FLAGS="-std=c++0x" EXTRA_FLAGS="-std=c++0x -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
-Wnewline-eof -Wpadded -Wmissing-prototypes -Wstrict-aliasing=2 \
-Wstrict-overflow=4"
case $TRIPLE in case $TRIPLE in
*-apple-*) *-apple-*)

View File

@@ -61,7 +61,7 @@ static
steady_clock::rep steady_clock::rep
steady_simplified() steady_simplified()
{ {
return mach_absolute_time(); return static_cast<steady_clock::rep>(mach_absolute_time());
} }
static static

View File

@@ -16,8 +16,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
condition_variable::~condition_variable() condition_variable::~condition_variable()
{ {
int e = pthread_cond_destroy(&__cv_); pthread_cond_destroy(&__cv_);
// assert(e == 0);
} }
void void

View File

@@ -125,7 +125,7 @@ __libcpp_db::__insert_ic(void* __i, const void* __c)
" But it is being used in a translation unit with debug mode enabled." " But it is being used in a translation unit with debug mode enabled."
" Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1"; " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1";
_LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg); _LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg);
size_t hc = hash<const void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* c = __cbeg_[hc]; __c_node* c = __cbeg_[hc];
_LIBCPP_ASSERT(c != nullptr, errmsg); _LIBCPP_ASSERT(c != nullptr, errmsg);
while (c->__c_ != __c) while (c->__c_ != __c)
@@ -141,9 +141,9 @@ __c_node*
__libcpp_db::__insert_c(void* __c) __libcpp_db::__insert_c(void* __c)
{ {
WLock _(mut()); WLock _(mut());
if (__csz_ + 1 > __cend_ - __cbeg_) if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
{ {
size_t nc = __next_prime(2*(__cend_ - __cbeg_) + 1); size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
__c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*)); __c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*));
if (cbeg == nullptr) if (cbeg == nullptr)
throw bad_alloc(); throw bad_alloc();
@@ -163,7 +163,7 @@ __libcpp_db::__insert_c(void* __c)
__cbeg_ = cbeg; __cbeg_ = cbeg;
__cend_ = __cbeg_ + nc; __cend_ = __cbeg_ + nc;
} }
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc]; __c_node* p = __cbeg_[hc];
__c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node)); __c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node));
if (__cbeg_[hc] == nullptr) if (__cbeg_[hc] == nullptr)
@@ -180,7 +180,7 @@ __libcpp_db::__erase_i(void* __i)
WLock _(mut()); WLock _(mut());
if (__ibeg_ != __iend_) if (__ibeg_ != __iend_)
{ {
size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_); size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi]; __i_node* p = __ibeg_[hi];
if (p != nullptr) if (p != nullptr)
{ {
@@ -209,7 +209,7 @@ void
__libcpp_db::__invalidate_all(void* __c) __libcpp_db::__invalidate_all(void* __c)
{ {
WLock _(mut()); WLock _(mut());
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc]; __c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A"); _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A");
while (p->__c_ != __c) while (p->__c_ != __c)
@@ -228,7 +228,7 @@ __c_node*
__libcpp_db::__find_c_and_lock(void* __c) const __libcpp_db::__find_c_and_lock(void* __c) const
{ {
mut().lock(); mut().lock();
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc]; __c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A"); _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A");
while (p->__c_ != __c) while (p->__c_ != __c)
@@ -242,7 +242,7 @@ __libcpp_db::__find_c_and_lock(void* __c) const
__c_node* __c_node*
__libcpp_db::__find_c(void* __c) const __libcpp_db::__find_c(void* __c) const
{ {
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc]; __c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A"); _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A");
while (p->__c_ != __c) while (p->__c_ != __c)
@@ -263,7 +263,7 @@ void
__libcpp_db::__erase_c(void* __c) __libcpp_db::__erase_c(void* __c)
{ {
WLock _(mut()); WLock _(mut());
size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc]; __c_node* p = __cbeg_[hc];
__c_node* q = nullptr; __c_node* q = nullptr;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A"); _LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
@@ -360,7 +360,7 @@ void
__libcpp_db::swap(void* c1, void* c2) __libcpp_db::swap(void* c1, void* c2)
{ {
WLock _(mut()); WLock _(mut());
size_t hc = hash<void*>()(c1) % (__cend_ - __cbeg_); size_t hc = hash<void*>()(c1) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p1 = __cbeg_[hc]; __c_node* p1 = __cbeg_[hc];
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A"); _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
while (p1->__c_ != c1) while (p1->__c_ != c1)
@@ -368,7 +368,7 @@ __libcpp_db::swap(void* c1, void* c2)
p1 = p1->__next_; p1 = p1->__next_;
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B"); _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B");
} }
hc = hash<void*>()(c2) % (__cend_ - __cbeg_); hc = hash<void*>()(c2) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p2 = __cbeg_[hc]; __c_node* p2 = __cbeg_[hc];
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C"); _LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C");
while (p2->__c_ != c2) while (p2->__c_ != c2)
@@ -397,7 +397,7 @@ __c_node::__add(__i_node* i)
{ {
if (end_ == cap_) if (end_ == cap_)
{ {
size_t nc = 2*(cap_ - beg_); size_t nc = 2*static_cast<size_t>(cap_ - beg_);
if (nc == 0) if (nc == 0)
nc = 1; nc = 1;
__i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*)); __i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*));
@@ -419,9 +419,9 @@ _LIBCPP_HIDDEN
__i_node* __i_node*
__libcpp_db::__insert_iterator(void* __i) __libcpp_db::__insert_iterator(void* __i)
{ {
if (__isz_ + 1 > __iend_ - __ibeg_) if (__isz_ + 1 > static_cast<size_t>(__iend_ - __ibeg_))
{ {
size_t nc = __next_prime(2*(__iend_ - __ibeg_) + 1); size_t nc = __next_prime(2*static_cast<size_t>(__iend_ - __ibeg_) + 1);
__i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*)); __i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*));
if (ibeg == nullptr) if (ibeg == nullptr)
throw bad_alloc(); throw bad_alloc();
@@ -441,7 +441,7 @@ __libcpp_db::__insert_iterator(void* __i)
__ibeg_ = ibeg; __ibeg_ = ibeg;
__iend_ = __ibeg_ + nc; __iend_ = __ibeg_ + nc;
} }
size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_); size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi]; __i_node* p = __ibeg_[hi];
__i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node)); __i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node));
if (r == nullptr) if (r == nullptr)
@@ -458,7 +458,7 @@ __libcpp_db::__find_iterator(const void* __i) const
__i_node* r = nullptr; __i_node* r = nullptr;
if (__ibeg_ != __iend_) if (__ibeg_ != __iend_)
{ {
size_t h = hash<const void*>()(__i) % (__iend_ - __ibeg_); size_t h = hash<const void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_) for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_)
{ {
if (nd->__i_ == __i) if (nd->__i_ == __i)
@@ -478,7 +478,7 @@ __c_node::__remove(__i_node* p)
__i_node** r = find(beg_, end_, p); __i_node** r = find(beg_, end_, p);
_LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove"); _LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove");
if (--end_ != r) if (--end_ != r)
memmove(r, r+1, (end_ - r)*sizeof(__i_node*)); memmove(r, r+1, static_cast<size_t>(end_ - r)*sizeof(__i_node*));
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -152,9 +152,9 @@ __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
{ {
if (!__is_ready()) if (!__is_ready())
{ {
if (__state_ & deferred) if (__state_ & static_cast<unsigned>(deferred))
{ {
__state_ &= ~deferred; __state_ &= ~static_cast<unsigned>(deferred);
__lk.unlock(); __lk.unlock();
__execute(); __execute();
} }

View File

@@ -181,7 +181,8 @@ __next_prime(size_t n)
// Select first potential prime >= n // Select first potential prime >= n
// Known a-priori n >= L // Known a-priori n >= L
size_t k0 = n / L; size_t k0 = n / L;
size_t in = std::lower_bound(indices, indices + M, n - k0 * L) - indices; size_t in = static_cast<size_t>(std::lower_bound(indices, indices + M, n - k0 * L)
- indices);
n = L * k0 + indices[in]; n = L * k0 + indices[in];
while (true) while (true)
{ {

View File

@@ -77,12 +77,15 @@ make(A0 a0, A1 a1, A2 a2)
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
class _LIBCPP_HIDDEN locale::__imp class _LIBCPP_HIDDEN locale::__imp
: public facet : public facet
{ {
enum {N = 28}; enum {N = 28};
string name_;
vector<facet*, __sso_allocator<facet*, N> > facets_; vector<facet*, __sso_allocator<facet*, N> > facets_;
string name_;
public: public:
explicit __imp(size_t refs = 0); explicit __imp(size_t refs = 0);
explicit __imp(const string& name, size_t refs = 0); explicit __imp(const string& name, size_t refs = 0);
@@ -93,7 +96,8 @@ public:
~__imp(); ~__imp();
const string& name() const {return name_;} const string& name() const {return name_;}
bool has_facet(long id) const {return id < facets_.size() && facets_[id];} bool has_facet(long id) const
{return static_cast<size_t>(id) < facets_.size() && facets_[static_cast<size_t>(id)];}
const locale::facet* use_facet(long id) const; const locale::facet* use_facet(long id) const;
static const locale& make_classic(); static const locale& make_classic();
@@ -104,46 +108,48 @@ private:
template <class F> void install_from(const __imp& other); template <class F> void install_from(const __imp& other);
}; };
#pragma clang diagnostic pop
locale::__imp::__imp(size_t refs) locale::__imp::__imp(size_t refs)
: facet(refs), : facet(refs),
name_("C"), facets_(N),
facets_(N) name_("C")
{ {
facets_.clear(); facets_.clear();
install(&make<_VSTD::collate<char> >(1)); install(&make<_VSTD::collate<char> >(1u));
install(&make<_VSTD::collate<wchar_t> >(1)); install(&make<_VSTD::collate<wchar_t> >(1u));
install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1)); install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1u));
install(&make<_VSTD::ctype<wchar_t> >(1)); install(&make<_VSTD::ctype<wchar_t> >(1u));
install(&make<codecvt<char, char, mbstate_t> >(1)); install(&make<codecvt<char, char, mbstate_t> >(1u));
install(&make<codecvt<wchar_t, char, mbstate_t> >(1)); install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
install(&make<codecvt<char16_t, char, mbstate_t> >(1)); install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
install(&make<codecvt<char32_t, char, mbstate_t> >(1)); install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
install(&make<numpunct<char> >(1)); install(&make<numpunct<char> >(1u));
install(&make<numpunct<wchar_t> >(1)); install(&make<numpunct<wchar_t> >(1u));
install(&make<num_get<char> >(1)); install(&make<num_get<char> >(1u));
install(&make<num_get<wchar_t> >(1)); install(&make<num_get<wchar_t> >(1u));
install(&make<num_put<char> >(1)); install(&make<num_put<char> >(1u));
install(&make<num_put<wchar_t> >(1)); install(&make<num_put<wchar_t> >(1u));
install(&make<moneypunct<char, false> >(1)); install(&make<moneypunct<char, false> >(1u));
install(&make<moneypunct<char, true> >(1)); install(&make<moneypunct<char, true> >(1u));
install(&make<moneypunct<wchar_t, false> >(1)); install(&make<moneypunct<wchar_t, false> >(1u));
install(&make<moneypunct<wchar_t, true> >(1)); install(&make<moneypunct<wchar_t, true> >(1u));
install(&make<money_get<char> >(1)); install(&make<money_get<char> >(1u));
install(&make<money_get<wchar_t> >(1)); install(&make<money_get<wchar_t> >(1u));
install(&make<money_put<char> >(1)); install(&make<money_put<char> >(1u));
install(&make<money_put<wchar_t> >(1)); install(&make<money_put<wchar_t> >(1u));
install(&make<time_get<char> >(1)); install(&make<time_get<char> >(1u));
install(&make<time_get<wchar_t> >(1)); install(&make<time_get<wchar_t> >(1u));
install(&make<time_put<char> >(1)); install(&make<time_put<char> >(1u));
install(&make<time_put<wchar_t> >(1)); install(&make<time_put<wchar_t> >(1u));
install(&make<_VSTD::messages<char> >(1)); install(&make<_VSTD::messages<char> >(1u));
install(&make<_VSTD::messages<wchar_t> >(1)); install(&make<_VSTD::messages<wchar_t> >(1u));
} }
locale::__imp::__imp(const string& name, size_t refs) locale::__imp::__imp(const string& name, size_t refs)
: facet(refs), : facet(refs),
name_(name), facets_(N),
facets_(N) name_(name)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
@@ -186,8 +192,8 @@ locale::__imp::__imp(const string& name, size_t refs)
} }
locale::__imp::__imp(const __imp& other) locale::__imp::__imp(const __imp& other)
: name_(other.name_), : facets_(max<size_t>(N, other.facets_.size())),
facets_(max<size_t>(N, other.facets_.size())) name_(other.name_)
{ {
facets_ = other.facets_; facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i) for (unsigned i = 0; i < facets_.size(); ++i)
@@ -196,8 +202,8 @@ locale::__imp::__imp(const __imp& other)
} }
locale::__imp::__imp(const __imp& other, const string& name, locale::category c) locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
: name_("*"), : facets_(N),
facets_(N) name_("*")
{ {
facets_ = other.facets_; facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i) for (unsigned i = 0; i < facets_.size(); ++i)
@@ -267,8 +273,8 @@ locale::__imp::install_from(const locale::__imp& one)
} }
locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
: name_("*"), : facets_(N),
facets_(N) name_("*")
{ {
facets_ = other.facets_; facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i) for (unsigned i = 0; i < facets_.size(); ++i)
@@ -337,8 +343,8 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
} }
locale::__imp::__imp(const __imp& other, facet* f, long id) locale::__imp::__imp(const __imp& other, facet* f, long id)
: name_("*"), : facets_(max<size_t>(N, other.facets_.size()+1)),
facets_(max<size_t>(N, other.facets_.size()+1)) name_("*")
{ {
f->__add_shared(); f->__add_shared();
unique_ptr<facet, release> hold(f); unique_ptr<facet, release> hold(f);
@@ -361,11 +367,11 @@ locale::__imp::install(facet* f, long id)
{ {
f->__add_shared(); f->__add_shared();
unique_ptr<facet, release> hold(f); unique_ptr<facet, release> hold(f);
if (id >= facets_.size()) if (static_cast<size_t>(id) >= facets_.size())
facets_.resize(id+1); facets_.resize(static_cast<size_t>(id+1));
if (facets_[id]) if (facets_[static_cast<size_t>(id)])
facets_[id]->__release_shared(); facets_[static_cast<size_t>(id)]->__release_shared();
facets_[id] = hold.release(); facets_[static_cast<size_t>(id)] = hold.release();
} }
const locale::facet* const locale::facet*
@@ -375,7 +381,7 @@ locale::__imp::use_facet(long id) const
if (!has_facet(id)) if (!has_facet(id))
throw bad_cast(); throw bad_cast();
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
return facets_[id]; return facets_[static_cast<size_t>(id)];
} }
// locale // locale
@@ -386,7 +392,7 @@ locale::__imp::make_classic()
// only one thread can get in here and it only gets in once // only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf; static aligned_storage<sizeof(locale)>::type buf;
locale* c = (locale*)&buf; locale* c = (locale*)&buf;
c->__locale_ = &make<__imp>(1); c->__locale_ = &make<__imp>(1u);
return *c; return *c;
} }
@@ -402,7 +408,6 @@ locale::__imp::make_global()
{ {
// only one thread can get in here and it only gets in once // only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf; static aligned_storage<sizeof(locale)>::type buf;
locale* g = (locale*)&buf;
::new (&buf) locale(locale::classic()); ::new (&buf) locale(locale::classic());
return *(locale*)&buf; return *(locale*)&buf;
} }
@@ -800,7 +805,7 @@ ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfau
{ {
for (; low != high; ++low, ++dest) for (; low != high; ++low, ++dest)
if (isascii(*low)) if (isascii(*low))
*dest = *low; *dest = static_cast<char>(*low);
else else
*dest = dfault; *dest = dfault;
return low; return low;
@@ -829,7 +834,8 @@ char
ctype<char>::do_toupper(char_type c) const ctype<char>::do_toupper(char_type c) const
{ {
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__GLIBC__) #elif defined(__GLIBC__)
return isascii(c) ? __classic_upper_table()[c] : c; return isascii(c) ? __classic_upper_table()[c] : c;
#else #else
@@ -842,7 +848,8 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
{ {
for (; low != high; ++low) for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; *low = isascii(*low) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__GLIBC__) #elif defined(__GLIBC__)
*low = isascii(*low) ? __classic_upper_table()[*low] : *low; *low = isascii(*low) ? __classic_upper_table()[*low] : *low;
#else #else
@@ -855,7 +862,8 @@ char
ctype<char>::do_tolower(char_type c) const ctype<char>::do_tolower(char_type c) const
{ {
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__GLIBC__) #elif defined(__GLIBC__)
return isascii(c) ? __classic_lower_table()[c] : c; return isascii(c) ? __classic_lower_table()[c] : c;
#else #else
@@ -868,7 +876,7 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const
{ {
for (; low != high; ++low) for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__GLIBC__) #elif defined(__GLIBC__)
*low = isascii(*low) ? __classic_lower_table()[*low] : *low; *low = isascii(*low) ? __classic_lower_table()[*low] : *low;
#else #else
@@ -972,28 +980,28 @@ ctype_byname<char>::~ctype_byname()
char char
ctype_byname<char>::do_toupper(char_type c) const ctype_byname<char>::do_toupper(char_type c) const
{ {
return toupper_l(c, __l); return static_cast<char>(toupper_l(c, __l));
} }
const char* const char*
ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const
{ {
for (; low != high; ++low) for (; low != high; ++low)
*low = toupper_l(*low, __l); *low = static_cast<char>(toupper_l(*low, __l));
return low; return low;
} }
char char
ctype_byname<char>::do_tolower(char_type c) const ctype_byname<char>::do_tolower(char_type c) const
{ {
return tolower_l(c, __l); return static_cast<char>(tolower_l(c, __l));
} }
const char* const char*
ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const
{ {
for (; low != high; ++low) for (; low != high; ++low)
*low = tolower_l(*low, __l); *low = static_cast<char>(tolower_l(*low, __l));
return low; return low;
} }
@@ -1258,7 +1266,7 @@ int
codecvt<char, char, mbstate_t>::do_length(state_type&, codecvt<char, char, mbstate_t>::do_length(state_type&,
const extern_type* frm, const extern_type* end, size_t mx) const const extern_type* frm, const extern_type* end, size_t mx) const
{ {
return static_cast<int>(min<size_t>(mx, end-frm)); return static_cast<int>(min<size_t>(mx, static_cast<size_t>(end-frm)));
} }
int int
@@ -1311,7 +1319,8 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
// save state in case needed to reover to_nxt on error // save state in case needed to reover to_nxt on error
mbstate_t save_state = st; mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); size_t n = wcsnrtombs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
static_cast<size_t>(to_end-to), &st, __l);
#else #else
size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif #endif
@@ -1348,7 +1357,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
#endif #endif
if (n == size_t(-1)) // on error if (n == size_t(-1)) // on error
return error; return error;
if (n > to_end-to_nxt) // is there room? if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
return partial; return partial;
for (extern_type* p = tmp; n; --n) // write it for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++; *to_nxt++ = *p++;
@@ -1379,7 +1388,8 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
// save state in case needed to reover to_nxt on error // save state in case needed to reover to_nxt on error
mbstate_t save_state = st; mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); size_t n = mbsnrtowcs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
static_cast<size_t>(to_end-to), &st, __l);
#else #else
size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l); size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif #endif
@@ -1389,7 +1399,8 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
for (to_nxt = to; frm != frm_nxt; ++to_nxt) for (to_nxt = to; frm != frm_nxt; ++to_nxt)
{ {
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); n = mbrtowc_l(to_nxt, frm, static_cast<size_t>(fend-frm),
&save_state, __l);
#else #else
n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l); n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#endif #endif
@@ -1452,7 +1463,7 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
if (n == size_t(-1) || n == 0) // on error if (n == size_t(-1) || n == 0) // on error
return error; return error;
--n; --n;
if (n > to_end-to_nxt) // is there room? if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
return partial; return partial;
for (extern_type* p = tmp; n; --n) // write it for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++; *to_nxt++ = *p++;
@@ -1494,7 +1505,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t) for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
{ {
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t n = mbrlen_l(frm, frm_end-frm, &st, __l); size_t n = mbrlen_l(frm, static_cast<size_t>(frm_end-frm), &st, __l);
#else #else
size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l); size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
#endif #endif
@@ -1977,9 +1988,6 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
break; break;
uint8_t c2 = frm_nxt[1]; uint8_t c2 = frm_nxt[1];
uint8_t c3 = frm_nxt[2]; uint8_t c3 = frm_nxt[2];
uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
| ((c2 & 0x3F) << 6)
| (c3 & 0x3F));
switch (c1) switch (c1)
{ {
case 0xE0: case 0xE0:
@@ -1997,7 +2005,7 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
} }
if ((c3 & 0xC0) != 0x80) if ((c3 & 0xC0) != 0x80)
break; break;
if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break; break;
frm_nxt += 3; frm_nxt += 3;
} }
@@ -2239,7 +2247,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{ {
if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80)) if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
break; break;
if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode) if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
break; break;
frm_nxt += 2; frm_nxt += 2;
} }
@@ -2266,7 +2274,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
} }
if ((c3 & 0xC0) != 0x80) if ((c3 & 0xC0) != 0x80)
break; break;
if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break; break;
frm_nxt += 3; frm_nxt += 3;
} }
@@ -2294,12 +2302,8 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
} }
if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80) if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
break; break;
uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18) if ((((c1 & 0x07u) << 18) | ((c2 & 0x3Fu) << 12) |
| ((c2 & 0x3F) << 12) ((c3 & 0x3Fu) << 6) | (c4 & 0x3Fu)) > Maxcode)
| ((c3 & 0x3F) << 6)
| (c4 & 0x3F));
if ((((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
((c3 & 0x3F) << 6) | (c4 & 0x3F)) > Maxcode)
break; break;
frm_nxt += 4; frm_nxt += 4;
} }
@@ -2468,7 +2472,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
{ {
if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80)) if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
break; break;
if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode) if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
break; break;
frm_nxt += 2; frm_nxt += 2;
} }
@@ -2495,7 +2499,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
} }
if ((c3 & 0xC0) != 0x80) if ((c3 & 0xC0) != 0x80)
break; break;
if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode) if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break; break;
frm_nxt += 3; frm_nxt += 3;
} }
@@ -2567,7 +2571,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
} }
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{ {
uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xFC00) == 0xDC00) if ((c1 & 0xFC00) == 0xDC00)
return codecvt_base::error; return codecvt_base::error;
if ((c1 & 0xFC00) != 0xD800) if ((c1 & 0xFC00) != 0xD800)
@@ -2581,7 +2585,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
{ {
if (frm_end-frm_nxt < 4) if (frm_end-frm_nxt < 4)
return codecvt_base::partial; return codecvt_base::partial;
uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3]; uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
if ((c2 & 0xFC00) != 0xDC00) if ((c2 & 0xFC00) != 0xDC00)
return codecvt_base::error; return codecvt_base::error;
uint32_t t = static_cast<uint32_t>( uint32_t t = static_cast<uint32_t>(
@@ -2612,7 +2616,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
} }
for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
{ {
uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xFC00) == 0xDC00) if ((c1 & 0xFC00) == 0xDC00)
break; break;
if ((c1 & 0xFC00) != 0xD800) if ((c1 & 0xFC00) != 0xD800)
@@ -2625,7 +2629,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{ {
if (frm_end-frm_nxt < 4) if (frm_end-frm_nxt < 4)
break; break;
uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3]; uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
if ((c2 & 0xFC00) != 0xDC00) if ((c2 & 0xFC00) != 0xDC00)
break; break;
uint32_t t = static_cast<uint32_t>( uint32_t t = static_cast<uint32_t>(
@@ -2700,7 +2704,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
} }
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{ {
uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xFC00) == 0xDC00) if ((c1 & 0xFC00) == 0xDC00)
return codecvt_base::error; return codecvt_base::error;
if ((c1 & 0xFC00) != 0xD800) if ((c1 & 0xFC00) != 0xD800)
@@ -2714,7 +2718,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
{ {
if (frm_end-frm_nxt < 4) if (frm_end-frm_nxt < 4)
return codecvt_base::partial; return codecvt_base::partial;
uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2]; uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
if ((c2 & 0xFC00) != 0xDC00) if ((c2 & 0xFC00) != 0xDC00)
return codecvt_base::error; return codecvt_base::error;
uint32_t t = static_cast<uint32_t>( uint32_t t = static_cast<uint32_t>(
@@ -2745,7 +2749,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
} }
for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t) for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
{ {
uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xFC00) == 0xDC00) if ((c1 & 0xFC00) == 0xDC00)
break; break;
if ((c1 & 0xFC00) != 0xD800) if ((c1 & 0xFC00) != 0xD800)
@@ -2758,7 +2762,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{ {
if (frm_end-frm_nxt < 4) if (frm_end-frm_nxt < 4)
break; break;
uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2]; uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
if ((c2 & 0xFC00) != 0xDC00) if ((c2 & 0xFC00) != 0xDC00)
break; break;
uint32_t t = static_cast<uint32_t>( uint32_t t = static_cast<uint32_t>(
@@ -2816,7 +2820,7 @@ utf16be_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
} }
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{ {
uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
return codecvt_base::error; return codecvt_base::error;
*to_nxt = c1; *to_nxt = c1;
@@ -2840,7 +2844,7 @@ utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
} }
for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
{ {
uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
break; break;
frm_nxt += 2; frm_nxt += 2;
@@ -2891,7 +2895,7 @@ utf16le_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
} }
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt) for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{ {
uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
return codecvt_base::error; return codecvt_base::error;
*to_nxt = c1; *to_nxt = c1;
@@ -2915,7 +2919,7 @@ utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
} }
for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t) for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
{ {
uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0]; uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode) if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
break; break;
frm_nxt += 2; frm_nxt += 2;
@@ -4159,7 +4163,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
{ {
if (0 < *__ig && *__ig < numeric_limits<char>::max()) if (0 < *__ig && *__ig < numeric_limits<char>::max())
{ {
if (*__ig != *__r) if (static_cast<unsigned>(*__ig) != *__r)
{ {
__err = ios_base::failbit; __err = ios_base::failbit;
return; return;
@@ -4170,7 +4174,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
} }
if (0 < *__ig && *__ig < numeric_limits<char>::max()) if (0 < *__ig && *__ig < numeric_limits<char>::max())
{ {
if (*__ig < __g_end[-1] || __g_end[-1] == 0) if (static_cast<unsigned>(*__ig) < __g_end[-1] || __g_end[-1] == 0)
__err = ios_base::failbit; __err = ios_base::failbit;
} }
} }
@@ -4576,7 +4580,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
} }
char* w = bb; char* w = bb;
ios_base::iostate err = ios_base::goodbit; ios_base::iostate err = ios_base::goodbit;
int i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14, ptrdiff_t i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14,
ct, err, false) ct, err, false)
- this->__weeks_; - this->__weeks_;
if (i < 14) if (i < 14)
@@ -4687,6 +4691,9 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
return result; return result;
} }
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
template <> template <>
wstring wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
@@ -4705,19 +4712,19 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
char f[3] = {0}; char f[3] = {0};
f[0] = '%'; f[0] = '%';
f[1] = fmt; f[1] = fmt;
size_t be = strftime_l(buf, 100, f, &t, __loc_); strftime_l(buf, 100, f, &t, __loc_);
wchar_t wbuf[100]; wchar_t wbuf[100];
wchar_t* wbb = wbuf; wchar_t* wbb = wbuf;
mbstate_t mb = {0}; mbstate_t mb = {0};
const char* bb = buf; const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); size_t j = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else #else
size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); size_t j = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (i == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wchar_t* wbe = wbb + i; wchar_t* wbe = wbb + j;
wstring result; wstring result;
while (wbb != wbe) while (wbb != wbe)
{ {
@@ -4730,7 +4737,7 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
} }
wchar_t* w = wbb; wchar_t* w = wbb;
ios_base::iostate err = ios_base::goodbit; ios_base::iostate err = ios_base::goodbit;
int i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14, ptrdiff_t i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14,
ct, err, false) ct, err, false)
- this->__weeks_; - this->__weeks_;
if (i < 14) if (i < 14)
@@ -4900,7 +4907,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__weeks_[i].assign(wbuf, wbe); __weeks_[i].assign(wbuf, wbe);
@@ -4912,7 +4919,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__weeks_[i+7].assign(wbuf, wbe); __weeks_[i+7].assign(wbuf, wbe);
@@ -4929,7 +4936,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__months_[i].assign(wbuf, wbe); __months_[i].assign(wbuf, wbe);
@@ -4941,7 +4948,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__months_[i+12].assign(wbuf, wbe); __months_[i+12].assign(wbuf, wbe);
@@ -4956,7 +4963,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__am_pm_[0].assign(wbuf, wbe); __am_pm_[0].assign(wbuf, wbe);
@@ -4969,7 +4976,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__am_pm_[1].assign(wbuf, wbe); __am_pm_[1].assign(wbuf, wbe);
@@ -5230,7 +5237,7 @@ __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm,
char fmt[] = {'%', __fmt, __mod, 0}; char fmt[] = {'%', __fmt, __mod, 0};
if (__mod != 0) if (__mod != 0)
swap(fmt[1], fmt[2]); swap(fmt[1], fmt[2]);
size_t n = strftime_l(__nb, __ne-__nb, fmt, __tm, __loc_); size_t n = strftime_l(__nb, static_cast<size_t>(__ne-__nb), fmt, __tm, __loc_);
__ne = __nb + n; __ne = __nb + n;
} }
@@ -5248,7 +5255,7 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
#else #else
size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_); size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
__we = __wb + j; __we = __wb + j;
} }
@@ -5621,7 +5628,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else #else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j; wchar_t* wbe = wbuf + j;
__curr_symbol_.assign(wbuf, wbe); __curr_symbol_.assign(wbuf, wbe);
@@ -5640,7 +5647,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe); __positive_sign_.assign(wbuf, wbe);
@@ -5656,7 +5663,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__negative_sign_.assign(wbuf, wbe); __negative_sign_.assign(wbuf, wbe);
@@ -5698,7 +5705,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else #else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j; wchar_t* wbe = wbuf + j;
__curr_symbol_.assign(wbuf, wbe); __curr_symbol_.assign(wbuf, wbe);
@@ -5721,7 +5728,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe); __positive_sign_.assign(wbuf, wbe);
@@ -5741,7 +5748,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else #else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get()); j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif #endif
if (j == -1) if (j == size_t(-1))
__throw_runtime_error("locale not supported"); __throw_runtime_error("locale not supported");
wbe = wbuf + j; wbe = wbuf + j;
__negative_sign_.assign(wbuf, wbe); __negative_sign_.assign(wbuf, wbe);
@@ -5770,14 +5777,14 @@ template class collate<wchar_t>;
template class num_get<char>; template class num_get<char>;
template class num_get<wchar_t>; template class num_get<wchar_t>;
template class __num_get<char>; template struct __num_get<char>;
template class __num_get<wchar_t>; template struct __num_get<wchar_t>;
template class num_put<char>; template class num_put<char>;
template class num_put<wchar_t>; template class num_put<wchar_t>;
template class __num_put<char>; template struct __num_put<char>;
template class __num_put<wchar_t>; template struct __num_put<wchar_t>;
template class time_get<char>; template class time_get<char>;
template class time_get<wchar_t>; template class time_get<wchar_t>;

View File

@@ -154,7 +154,7 @@ align(size_t alignment, size_t size, void*& ptr, size_t& space)
{ {
char* p1 = static_cast<char*>(ptr); char* p1 = static_cast<char*>(ptr);
char* p2 = (char*)((size_t)(p1 + (alignment - 1)) & -alignment); char* p2 = (char*)((size_t)(p1 + (alignment - 1)) & -alignment);
ptrdiff_t d = p2 - p1; size_t d = static_cast<size_t>(p2 - p1);
if (d <= space - size) if (d <= space - size)
{ {
r = p2; r = p2;

View File

@@ -20,8 +20,7 @@ const adopt_lock_t adopt_lock = {};
mutex::~mutex() mutex::~mutex()
{ {
int e = pthread_mutex_destroy(&__m_); pthread_mutex_destroy(&__m_);
// assert(e == 0);
} }
void void

View File

@@ -83,7 +83,7 @@ operator new[](size_t size)
__attribute__((__weak__, __visibility__("default"))) __attribute__((__weak__, __visibility__("default")))
void* void*
operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
{ {
void* p = 0; void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS

View File

@@ -69,12 +69,17 @@ regex_error::~regex_error() throw() {}
namespace { namespace {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
struct collationnames struct collationnames
{ {
const char* elem_; const char* elem_;
char char_; char char_;
}; };
#pragma clang diagnostic pop
const collationnames collatenames[] = const collationnames collatenames[] =
{ {
{"A", 0x41}, {"A", 0x41},
@@ -190,12 +195,17 @@ const collationnames collatenames[] =
{"zero", 0x30} {"zero", 0x30}
}; };
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
struct classnames struct classnames
{ {
const char* elem_; const char* elem_;
ctype_base::mask mask_; ctype_base::mask mask_;
}; };
#pragma clang diagnostic pop
const classnames ClassNames[] = const classnames ClassNames[] =
{ {
{"alnum", ctype_base::alnum}, {"alnum", ctype_base::alnum},

View File

@@ -346,7 +346,7 @@ string to_string(int val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%d", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%d", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -363,7 +363,7 @@ string to_string(unsigned val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%u", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%u", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -380,7 +380,7 @@ string to_string(long val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%ld", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%ld", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -397,7 +397,7 @@ string to_string(unsigned long val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%lu", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%lu", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -414,7 +414,7 @@ string to_string(long long val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%lld", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%lld", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -431,7 +431,7 @@ string to_string(unsigned long long val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%llu", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%llu", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -448,7 +448,7 @@ string to_string(float val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%f", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%f", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -465,7 +465,7 @@ string to_string(double val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%f", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%f", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -482,7 +482,7 @@ string to_string(long double val)
s.resize(s.capacity()); s.resize(s.capacity());
while (true) while (true)
{ {
int n2 = snprintf(&s[0], s.size()+1, "%Lf", val); size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%Lf", val));
if (n2 <= s.size()) if (n2 <= s.size())
{ {
s.resize(n2); s.resize(n2);
@@ -505,7 +505,7 @@ wstring to_wstring(int val)
int n2 = swprintf(&s[0], s.size()+1, L"%d", val); int n2 = swprintf(&s[0], s.size()+1, L"%d", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -526,7 +526,7 @@ wstring to_wstring(unsigned val)
int n2 = swprintf(&s[0], s.size()+1, L"%u", val); int n2 = swprintf(&s[0], s.size()+1, L"%u", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -547,7 +547,7 @@ wstring to_wstring(long val)
int n2 = swprintf(&s[0], s.size()+1, L"%ld", val); int n2 = swprintf(&s[0], s.size()+1, L"%ld", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -568,7 +568,7 @@ wstring to_wstring(unsigned long val)
int n2 = swprintf(&s[0], s.size()+1, L"%lu", val); int n2 = swprintf(&s[0], s.size()+1, L"%lu", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -589,7 +589,7 @@ wstring to_wstring(long long val)
int n2 = swprintf(&s[0], s.size()+1, L"%lld", val); int n2 = swprintf(&s[0], s.size()+1, L"%lld", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -610,7 +610,7 @@ wstring to_wstring(unsigned long long val)
int n2 = swprintf(&s[0], s.size()+1, L"%llu", val); int n2 = swprintf(&s[0], s.size()+1, L"%llu", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -629,7 +629,7 @@ wstring to_wstring(float val)
int n2 = swprintf(&s[0], s.size()+1, L"%f", val); int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -648,7 +648,7 @@ wstring to_wstring(double val)
int n2 = swprintf(&s[0], s.size()+1, L"%f", val); int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());
@@ -667,7 +667,7 @@ wstring to_wstring(long double val)
int n2 = swprintf(&s[0], s.size()+1, L"%Lf", val); int n2 = swprintf(&s[0], s.size()+1, L"%Lf", val);
if (n2 > 0) if (n2 > 0)
{ {
s.resize(n2); s.resize(static_cast<size_t>(n2));
break; break;
} }
s.resize(2*s.size()); s.resize(2*s.size());

View File

@@ -34,7 +34,7 @@ void
strstreambuf::__init(char* __gnext, streamsize __n, char* __pbeg) strstreambuf::__init(char* __gnext, streamsize __n, char* __pbeg)
{ {
if (__n == 0) if (__n == 0)
__n = strlen(__gnext); __n = static_cast<streamsize>(strlen(__gnext));
else if (__n < 0) else if (__n < 0)
__n = INT_MAX; __n = INT_MAX;
if (__pbeg == nullptr) if (__pbeg == nullptr)
@@ -160,12 +160,12 @@ strstreambuf::overflow(int_type __c)
streamsize new_size = max<streamsize>(__alsize_, 2*old_size); streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
char* buf = nullptr; char* buf = nullptr;
if (__palloc_) if (__palloc_)
buf = static_cast<char*>(__palloc_(new_size)); buf = static_cast<char*>(__palloc_(static_cast<size_t>(new_size)));
else else
buf = new char[new_size]; buf = new char[new_size];
if (buf == nullptr) if (buf == nullptr)
return int_type(EOF); return int_type(EOF);
memcpy(buf, eback(), old_size); memcpy(buf, eback(), static_cast<size_t>(old_size));
ptrdiff_t ninp = gptr() - eback(); ptrdiff_t ninp = gptr() - eback();
ptrdiff_t einp = egptr() - eback(); ptrdiff_t einp = egptr() - eback();
ptrdiff_t nout = pptr() - pbase(); ptrdiff_t nout = pptr() - pbase();
@@ -179,7 +179,7 @@ strstreambuf::overflow(int_type __c)
} }
setg(buf, buf + ninp, buf + einp); setg(buf, buf + ninp, buf + einp);
setp(buf + einp, buf + einp + eout); setp(buf + einp, buf + einp + eout);
pbump(nout); pbump(static_cast<int>(nout));
__strmode_ |= __allocated; __strmode_ |= __allocated;
} }
*pptr() = static_cast<char>(__c); *pptr() = static_cast<char>(__c);

View File

@@ -55,7 +55,7 @@ unsigned
thread::hardware_concurrency() thread::hardware_concurrency()
{ {
#if defined(CTL_HW) && defined(HW_NCPU) #if defined(CTL_HW) && defined(HW_NCPU)
int n; unsigned n;
int mib[2] = {CTL_HW, HW_NCPU}; int mib[2] = {CTL_HW, HW_NCPU};
std::size_t s = sizeof(n); std::size_t s = sizeof(n);
sysctl(mib, 2, &n, &s, 0, 0); sysctl(mib, 2, &n, &s, 0, 0);