[cfe-commits] [libcxx] r142732 - in /libcxx/trunk: include/__bit_reference include/__config include/algorithm include/cctype include/cstdio include/cstdlib include/cstring include/cwchar include/iterator include/limits include/numeric include/string include/support/win32/limits_win32.h include/support/win32/support.h include/vector src/support/win32/support.cpp

Howard Hinnant hhinnant at apple.com
Sat Oct 22 13:59:45 PDT 2011


Author: hhinnant
Date: Sat Oct 22 15:59:45 2011
New Revision: 142732

URL: http://llvm.org/viewvc/llvm-project?rev=142732&view=rev
Log:
More windows port work by Ruben Van Boxem

Modified:
    libcxx/trunk/include/__bit_reference
    libcxx/trunk/include/__config
    libcxx/trunk/include/algorithm
    libcxx/trunk/include/cctype
    libcxx/trunk/include/cstdio
    libcxx/trunk/include/cstdlib
    libcxx/trunk/include/cstring
    libcxx/trunk/include/cwchar
    libcxx/trunk/include/iterator
    libcxx/trunk/include/limits
    libcxx/trunk/include/numeric
    libcxx/trunk/include/string
    libcxx/trunk/include/support/win32/limits_win32.h
    libcxx/trunk/include/support/win32/support.h
    libcxx/trunk/include/vector
    libcxx/trunk/src/support/win32/support.cpp

Modified: libcxx/trunk/include/__bit_reference
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Sat Oct 22 15:59:45 2011
@@ -218,9 +218,9 @@
 template <class _C, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 __bit_iterator<_C, false>
-find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
+find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value_)
 {
-    if (static_cast<bool>(__value))
+    if (static_cast<bool>(__value_))
         return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
     return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
 }
@@ -292,9 +292,9 @@
 template <class _C, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 typename __bit_iterator<_C, false>::difference_type
-count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
+count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value_)
 {
-    if (static_cast<bool>(__value))
+    if (static_cast<bool>(__value_))
         return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
     return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
 }
@@ -364,11 +364,11 @@
 template <class _C>
 _LIBCPP_INLINE_VISIBILITY inline
 void
-fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
+fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value_)
 {
     if (__n > 0)
     {
-        if (__value)
+        if (__value_)
             __fill_n_true(__first, __n);
         else
             __fill_n_false(__first, __n);
@@ -380,9 +380,9 @@
 template <class _C>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
+fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value_)
 {
-    _VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
+    _VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value_);
 }
 
 // copy

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Sat Oct 22 15:59:45 2011
@@ -321,6 +321,8 @@
 
 #elif defined(_MSC_VER)
 
+#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_UNICODE_CHARS

Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Sat Oct 22 15:59:45 2011
@@ -764,10 +764,10 @@
 template <class _InputIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _InputIterator
-find(_InputIterator __first, _InputIterator __last, const _Tp& __value)
+find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
 {
     for (; __first != __last; ++__first)
-        if (*__first == __value)
+        if (*__first == __value_)
             break;
     return __first;
 }
@@ -1004,11 +1004,11 @@
 template <class _InputIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 typename iterator_traits<_InputIterator>::difference_type
-count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
+count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
 {
     typename iterator_traits<_InputIterator>::difference_type __r(0);
     for (; __first != __last; ++__first)
-        if (*__first == __value)
+        if (*__first == __value_)
             ++__r;
     return __r;
 }
@@ -1312,22 +1312,22 @@
 template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp>
 _ForwardIterator
 __search_n(_ForwardIterator __first, _ForwardIterator __last,
-           _Size __count, const _Tp& __value, _BinaryPredicate __pred, forward_iterator_tag)
+           _Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag)
 {
     if (__count <= 0)
         return __first;
     while (true)
     {
-        // Find first element in sequence that matchs __value, with a mininum of loop checks
+        // Find first element in sequence that matchs __value_, with a mininum of loop checks
         while (true)
         {
-            if (__first == __last)  // return __last if no element matches __value
+            if (__first == __last)  // return __last if no element matches __value_
                 return __last;
-            if (__pred(*__first, __value))
+            if (__pred(*__first, __value_))
                 break;
             ++__first;
         }
-        // *__first matches __value, now match elements after here
+        // *__first matches __value_, now match elements after here
         _ForwardIterator __m = __first;
         _Size __c(0);
         while (true)
@@ -1336,7 +1336,7 @@
                 return __first;
             if (++__m == __last)  // Otherwise if source exhaused, pattern not found
                 return __last;
-            if (!__pred(*__m, __value))  // if there is a mismatch, restart with a new __first
+            if (!__pred(*__m, __value_))  // if there is a mismatch, restart with a new __first
             {
                 __first = __m;
                 ++__first;
@@ -1349,7 +1349,7 @@
 template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp>
 _RandomAccessIterator
 __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
-           _Size __count, const _Tp& __value, _BinaryPredicate __pred, random_access_iterator_tag)
+           _Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag)
 {
     if (__count <= 0)
         return __first;
@@ -1359,16 +1359,16 @@
     const _RandomAccessIterator __s = __last - (__count - 1);  // Start of pattern match can't go beyond here
     while (true)
     {
-        // Find first element in sequence that matchs __value, with a mininum of loop checks
+        // Find first element in sequence that matchs __value_, with a mininum of loop checks
         while (true)
         {
-            if (__first == __s)  // return __last if no element matches __value
+            if (__first == __s)  // return __last if no element matches __value_
                 return __last;
-            if (__pred(*__first, __value))
+            if (__pred(*__first, __value_))
                 break;
             ++__first;
         }
-        // *__first matches __value, now match elements after here
+        // *__first matches __value_, now match elements after here
         _RandomAccessIterator __m = __first;
         _Size __c(0);
         while (true)
@@ -1376,7 +1376,7 @@
             if (++__c == __count)  // If pattern exhausted, __first is the answer (works for 1 element pattern)
                 return __first;
              ++__m;          // no need to check range on __m because __s guarantees we have enough source
-            if (!__pred(*__m, __value))  // if there is a mismatch, restart with a new __first
+            if (!__pred(*__m, __value_))  // if there is a mismatch, restart with a new __first
             {
                 __first = __m;
                 ++__first;
@@ -1390,19 +1390,19 @@
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
 search_n(_ForwardIterator __first, _ForwardIterator __last,
-         _Size __count, const _Tp& __value, _BinaryPredicate __pred)
+         _Size __count, const _Tp& __value_, _BinaryPredicate __pred)
 {
     return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
-           (__first, __last, __count, __value, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
+           (__first, __last, __count, __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
 }
 
 template <class _ForwardIterator, class _Size, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
-search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value)
+search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
 {
     typedef typename iterator_traits<_ForwardIterator>::value_type __v;
-    return _VSTD::search_n(__first, __last, __count, __value, __equal_to<__v, _Tp>());
+    return _VSTD::search_n(__first, __last, __count, __value_, __equal_to<__v, _Tp>());
 }
 
 // copy
@@ -1744,29 +1744,29 @@
 template <class _OutputIterator, class _Size, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, false_type)
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, false_type)
 {
     for (; __n > 0; ++__first, --__n)
-        *__first = __value;
+        *__first = __value_;
     return __first;
 }
 
 template <class _OutputIterator, class _Size, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, true_type)
+__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, true_type)
 {
     if (__n > 0)
-        _VSTD::memset(__first, (unsigned char)__value, (size_t)(__n));
+        _VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n));
     return __first + __n;
 }
 
 template <class _OutputIterator, class _Size, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
+fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
 {
-   return _VSTD::__fill_n(__first, __n, __value, integral_constant<bool,
+   return _VSTD::__fill_n(__first, __n, __value_, integral_constant<bool,
                                               is_pointer<_OutputIterator>::value &&
                                               is_trivially_copy_assignable<_Tp>::value     &&
                                               sizeof(_Tp) == 1>());
@@ -1777,26 +1777,26 @@
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
+__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag)
 {
     for (; __first != __last; ++__first)
-        *__first = __value;
+        *__first = __value_;
 }
 
 template <class _RandomAccessIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
+__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag)
 {
-    _VSTD::fill_n(__first, __last - __first, __value);
+    _VSTD::fill_n(__first, __last - __first, __value_);
 }
 
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    _VSTD::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
+    _VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category());
 }
 
 // generate
@@ -1826,15 +1826,15 @@
 
 template <class _ForwardIterator, class _Tp>
 _ForwardIterator
-remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    __first = _VSTD::find(__first, __last, __value);
+    __first = _VSTD::find(__first, __last, __value_);
     if (__first != __last)
     {
         _ForwardIterator __i = __first;
         while (++__i != __last)
         {
-            if (!(*__i == __value))
+            if (!(*__i == __value_))
             {
                 *__first = _VSTD::move(*__i);
                 ++__first;
@@ -1872,11 +1872,11 @@
 template <class _InputIterator, class _OutputIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value)
+remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_)
 {
     for (; __first != __last; ++__first)
     {
-        if (!(*__first == __value))
+        if (!(*__first == __value_))
         {
             *__result = *__first;
             ++__result;
@@ -3683,6 +3683,10 @@
     _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
 }
 
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4231)
+#endif // _MSC_VER
 extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
 extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
 extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
@@ -3716,12 +3720,15 @@
 extern template bool __insertion_sort_incomplete<__less<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
+#pragma warning( pop )
+#endif _MSC_VER
 
 // lower_bound
 
 template <class _Compare, class _ForwardIterator, class _Tp>
 _ForwardIterator
-__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
     typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
     difference_type __len = _VSTD::distance(__first, __last);
@@ -3730,7 +3737,7 @@
         difference_type __l2 = __len / 2;
         _ForwardIterator __m = __first;
         _VSTD::advance(__m, __l2);
-        if (__comp(*__m, __value))
+        if (__comp(*__m, __value_))
         {
             __first = ++__m;
             __len -= __l2 + 1;
@@ -3744,24 +3751,24 @@
 template <class _ForwardIterator, class _Tp, class _Compare>
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
-lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
 #ifdef _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
     __debug_less<_Compare> __c(__comp);
-    return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
+    return __lower_bound<_Comp_ref>(__first, __last, __value_, __c);
 #else  // _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
-    return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
+    return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp);
 #endif  // _LIBCPP_DEBUG2
 }
 
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
-lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    return _VSTD::lower_bound(__first, __last, __value,
+    return _VSTD::lower_bound(__first, __last, __value_,
                              __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
 }
 
@@ -3769,7 +3776,7 @@
 
 template <class _Compare, class _ForwardIterator, class _Tp>
 _ForwardIterator
-__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
     typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
     difference_type __len = _VSTD::distance(__first, __last);
@@ -3778,7 +3785,7 @@
         difference_type __l2 = __len / 2;
         _ForwardIterator __m = __first;
         _VSTD::advance(__m, __l2);
-        if (__comp(__value, *__m))
+        if (__comp(__value_, *__m))
             __len = __l2;
         else
         {
@@ -3792,24 +3799,24 @@
 template <class _ForwardIterator, class _Tp, class _Compare>
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
-upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
 #ifdef _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
     __debug_less<_Compare> __c(__comp);
-    return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
+    return __upper_bound<_Comp_ref>(__first, __last, __value_, __c);
 #else  // _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
-    return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
+    return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp);
 #endif  // _LIBCPP_DEBUG2
 }
 
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _ForwardIterator
-upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    return _VSTD::upper_bound(__first, __last, __value,
+    return _VSTD::upper_bound(__first, __last, __value_,
                              __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>());
 }
 
@@ -3817,7 +3824,7 @@
 
 template <class _Compare, class _ForwardIterator, class _Tp>
 pair<_ForwardIterator, _ForwardIterator>
-__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
     typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
     difference_type __len = _VSTD::distance(__first, __last);
@@ -3826,12 +3833,12 @@
         difference_type __l2 = __len / 2;
         _ForwardIterator __m = __first;
         _VSTD::advance(__m, __l2);
-        if (__comp(*__m, __value))
+        if (__comp(*__m, __value_))
         {
             __first = ++__m;
             __len -= __l2 + 1;
         }
-        else if (__comp(__value, *__m))
+        else if (__comp(__value_, *__m))
         {
             __last = __m;
             __len = __l2;
@@ -3841,8 +3848,8 @@
             _ForwardIterator __mp1 = __m;
             return pair<_ForwardIterator, _ForwardIterator>
                    (
-                      __lower_bound<_Compare>(__first, __m, __value, __comp),
-                      __upper_bound<_Compare>(++__mp1, __last, __value, __comp)
+                      __lower_bound<_Compare>(__first, __m, __value_, __comp),
+                      __upper_bound<_Compare>(++__mp1, __last, __value_, __comp)
                    );
         }
     }
@@ -3852,24 +3859,24 @@
 template <class _ForwardIterator, class _Tp, class _Compare>
 inline _LIBCPP_INLINE_VISIBILITY
 pair<_ForwardIterator, _ForwardIterator>
-equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
 #ifdef _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
     __debug_less<_Compare> __c(__comp);
-    return __equal_range<_Comp_ref>(__first, __last, __value, __c);
+    return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
 #else  // _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
-    return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
+    return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
 #endif  // _LIBCPP_DEBUG2
 }
 
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 pair<_ForwardIterator, _ForwardIterator>
-equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    return _VSTD::equal_range(__first, __last, __value,
+    return _VSTD::equal_range(__first, __last, __value_,
                              __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
 }
 
@@ -3878,33 +3885,33 @@
 template <class _Compare, class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
-__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
-    __first = __lower_bound<_Compare>(__first, __last, __value, __comp);
-    return __first != __last && !__comp(__value, *__first);
+    __first = __lower_bound<_Compare>(__first, __last, __value_, __comp);
+    return __first != __last && !__comp(__value_, *__first);
 }
 
 template <class _ForwardIterator, class _Tp, class _Compare>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
 {
 #ifdef _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
     __debug_less<_Compare> __c(__comp);
-    return __binary_search<_Comp_ref>(__first, __last, __value, __c);
+    return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
 #else  // _LIBCPP_DEBUG2
     typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
-    return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
+    return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
 #endif  // _LIBCPP_DEBUG2
 }
 
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
-binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
+binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
 {
-    return _VSTD::binary_search(__first, __last, __value,
+    return _VSTD::binary_search(__first, __last, __value_,
                              __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
 }
 

Modified: libcxx/trunk/include/cctype
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cctype?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/cctype (original)
+++ libcxx/trunk/include/cctype Sat Oct 22 15:59:45 2011
@@ -37,6 +37,9 @@
 
 #include <__config>
 #include <ctype.h>
+#if defined(_MSC_VER)
+#include "support/win32/support.h"
+#endif // _MSC_VER
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header

Modified: libcxx/trunk/include/cstdio
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdio?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/cstdio (original)
+++ libcxx/trunk/include/cstdio Sat Oct 22 15:59:45 2011
@@ -126,13 +126,15 @@
 using ::snprintf;
 using ::sprintf;
 using ::sscanf;
+#ifndef _MSC_VER
 using ::vfprintf;
 using ::vfscanf;
-using ::vprintf;
 using ::vscanf;
+using ::vsscanf;
+#endif // _MSC_VER
+using ::vprintf;
 using ::vsnprintf;
 using ::vsprintf;
-using ::vsscanf;
 using ::fgetc;
 using ::fgets;
 using ::fputc;

Modified: libcxx/trunk/include/cstdlib
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Sat Oct 22 15:59:45 2011
@@ -81,6 +81,9 @@
 
 #include <__config>
 #include <stdlib.h>
+#ifdef _MSC_VER
+#include "support/win32/support.h"
+#endif // _MSC_VER
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -129,11 +132,13 @@
 using ::mbstowcs;
 using ::wcstombs;
 
+#ifndef _MSC_VER // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
 inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) {return  labs(__x);}
 inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
 
 inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) {return  ldiv(__x, __y);}
 inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
+#endif // _MSC_VER
 
 _LIBCPP_END_NAMESPACE_STD
 

Modified: libcxx/trunk/include/cstring
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/cstring (original)
+++ libcxx/trunk/include/cstring Sat Oct 22 15:59:45 2011
@@ -93,7 +93,8 @@
 
 using ::strstr;
 
-#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
+// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
+#if !defined(__GLIBC__) && !defined(_MSC_VER)
 inline _LIBCPP_INLINE_VISIBILITY       char* strchr(      char* __s, int __c) {return ::strchr(__s, __c);}
 inline _LIBCPP_INLINE_VISIBILITY       char* strpbrk(      char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
 inline _LIBCPP_INLINE_VISIBILITY       char* strrchr(      char* __s, int __c) {return ::strrchr(__s, __c);}

Modified: libcxx/trunk/include/cwchar
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cwchar?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/cwchar (original)
+++ libcxx/trunk/include/cwchar Sat Oct 22 15:59:45 2011
@@ -124,13 +124,15 @@
 using ::fwprintf;
 using ::fwscanf;
 using ::swprintf;
-using ::swscanf;
 using ::vfwprintf;
-using ::vfwscanf;
 using ::vswprintf;
-using ::vswscanf;
 using ::vwprintf;
+#ifndef _MSC_VER
+using ::swscanf;
+using ::vfwscanf;
+using ::vswscanf;
 using ::vwscanf;
+#endif // _MSC_VER
 using ::wprintf;
 using ::wscanf;
 using ::fgetwc;
@@ -144,8 +146,10 @@
 using ::putwchar;
 using ::ungetwc;
 using ::wcstod;
+#ifndef _MSC_VER
 using ::wcstof;
 using ::wcstold;
+#endif // _MSC_VER
 using ::wcstol;
 using ::wcstoll;
 using ::wcstoul;

Modified: libcxx/trunk/include/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Sat Oct 22 15:59:45 2011
@@ -626,11 +626,11 @@
     typedef _Container container_type;
 
     _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
-    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
-        {container->push_back(__value); return *this;}
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {container->push_back(__value_); return *this;}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
-        {container->push_back(_VSTD::move(__value)); return *this;}
+    _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {container->push_back(_VSTD::move(__value_)); return *this;}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*()     {return *this;}
     _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++()    {return *this;}
@@ -659,11 +659,11 @@
     typedef _Container container_type;
 
     _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
-    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
-        {container->push_front(__value); return *this;}
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {container->push_front(__value_); return *this;}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
-        {container->push_front(_VSTD::move(__value)); return *this;}
+    _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {container->push_front(_VSTD::move(__value_)); return *this;}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*()     {return *this;}
     _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++()    {return *this;}
@@ -694,11 +694,11 @@
 
     _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
         : container(&__x), iter(__i) {}
-    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
-        {iter = container->insert(iter, __value); ++iter; return *this;}
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
+        {iter = container->insert(iter, __value_); ++iter; return *this;}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
-        {iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;}
+    _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
+        {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*()        {return *this;}
     _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++()       {return *this;}
@@ -769,9 +769,9 @@
         : __out_stream_(&__s), __delim_(0) {}
     _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
         : __out_stream_(&__s), __delim_(__delimiter) {}
-    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value)
+    _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
         {
-            *__out_stream_ << __value;
+            *__out_stream_ << __value_;
             if (__delim_)
                 *__out_stream_ << __delim_;
             return *this;

Modified: libcxx/trunk/include/limits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/limits?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/limits (original)
+++ libcxx/trunk/include/limits Sat Oct 22 15:59:45 2011
@@ -109,6 +109,10 @@
 #include <__config>
 #include <type_traits>
 
+#if defined(_MSC_VER)
+#include "support/win32/limits_win32.h"
+#endif // _MSC_VER
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 enum float_round_style

Modified: libcxx/trunk/include/numeric
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/numeric?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/numeric (original)
+++ libcxx/trunk/include/numeric Sat Oct 22 15:59:45 2011
@@ -186,10 +186,10 @@
 template <class _ForwardIterator, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
+iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
 {
-    for (; __first != __last; ++__first, ++__value)
-        *__first = __value;
+    for (; __first != __last; ++__first, ++__value_)
+        *__first = __value_;
 }
 
 _LIBCPP_END_NAMESPACE_STD

Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Sat Oct 22 15:59:45 2011
@@ -1023,7 +1023,14 @@
 #endif
 }
 
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4231 )
+#endif // _MSC_VER
 extern template class __basic_string_common<true>;
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif // _MSC_VER
 
 template<class _CharT, class _Traits, class _Allocator>
 class _LIBCPP_VISIBLE basic_string

Modified: libcxx/trunk/include/support/win32/limits_win32.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/limits_win32.h?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/limits_win32.h (original)
+++ libcxx/trunk/include/support/win32/limits_win32.h Sat Oct 22 15:59:45 2011
@@ -15,6 +15,11 @@
 #error "This header is MSVC specific, Clang and GCC should not include it"
 #else
 
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#include <windows.h> // ymath.h works correctly
+
 #include <float.h> // limit constants
 
 #define __FLT_MANT_DIG__   FLT_MANT_DIG
@@ -57,16 +62,17 @@
 #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
 
 // __builtin replacements/workarounds
+#include <math.h> // HUGE_VAL
 #include <ymath.h> // internal MSVC header providing the needed functionality
-#define __builtin_huge_val()  HUGE_VAL
-#define __builtin_huge_valf() _FInf
-#define __builtin_huge_vall() _LInf
-#define __builtin_nan()       _Nan
-#define __builtin_nanf()      _FNan
-#define __builtin_nanl()      _LNan
-#define __builtin_nans()      _Snan
-#define __builtin_nansf()     _FSnan
-#define __builtin_nansl()     _LSnan
+#define __builtin_huge_val()     HUGE_VAL
+#define __builtin_huge_valf()    _FInf._Float
+#define __builtin_huge_vall()    _LInf._Long_double
+#define __builtin_nan(__dummy)   _Nan._Double
+#define __builtin_nanf(__dummy)  _FNan._Float
+#define __builtin_nanl(__dummmy) _LNan._Long_double
+#define __builtin_nans(__dummy)  _Snan._Double
+#define __builtin_nansf(__dummy) _FSnan._Float
+#define __builtin_nansl(__dummy) _LSnan._Long_double
 
 #endif // _MSC_VER
 

Modified: libcxx/trunk/include/support/win32/support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/support.h?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/support/win32/support.h (original)
+++ libcxx/trunk/include/support/win32/support.h Sat Oct 22 15:59:45 2011
@@ -15,17 +15,81 @@
    Functions and constants used in libc++ that are missing from the Windows C library.
   */
 
+#include <__config>
 #include <wchar.h>  // mbstate_t
 #include <stdio.h> // _snwprintf
 #define swprintf _snwprintf
 #define vswprintf _vsnwprintf
+#define vfscnaf fscanf
 
-int vasprintf( char **sptr, const char *__restrict__ fmt , va_list ap );
-int asprintf(char **sptr, const char *__restrict__ fmt, ...);
+int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
+int asprintf( char **sptr, const char *__restrict fmt, ...);
+//int vfscanf( FILE *__restrict stream, const char *__restrict format,
+//             va_list arg);
 
-size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
-                   size_t nmc, size_t len, mbstate_t *__restrict__ ps );
-size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
-                   size_t nwc, size_t len, mbstate_t *__restrict__ ps );
+size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
+                   size_t nmc, size_t len, mbstate_t *__restrict ps );
+size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
+                   size_t nwc, size_t len, mbstate_t *__restrict ps );
+				   
+#if defined(_MSC_VER)
+#define snprintf _snprintf
+inline int isblank( int c, locale_t /*loc*/ )
+{ return ( c == ' ' || c == '\t' ); }
+inline int iswblank( wint_t c, locale_t /*loc*/ )
+{ return ( c == L' ' || c == L'\t' ); }
+#include <xlocinfo.h>
+#define atoll _atoi64
+#define strtoll _strtoi64
+#define strtoull _strtoui64
+#define wcstoll _wcstoi64
+#define wcstoull _wcstoui64
+_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
+{ return _Stof(nptr, endptr, 0); }
+_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
+{ return _Stod(nptr, endptr, 0); }
+_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
+{ return _Stold(nptr, endptr, 0); }
+_LIBCPP_ALWAYS_INLINE float wcstof( const wchar_t *nptr, char** endptr )
+
+#define _Exit _exit
+
+#include <intrin.h>
+#define __builtin_popcount __popcnt
+#define __builtin_popcountl __popcnt
+#define __builtin_popcountll(__i) static_cast<int>(__popcnt64(__i))
+
+_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
+{
+   DWORD r = 0;
+   _BitScanReverse(&r, x);
+   return static_cast<int>(r);
+}
+// sizeof(long) == sizeof(int) on Windows
+_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
+{ return __builtin_ctz( static_cast<int>(x) ); }
+_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
+{
+    DWORD r = 0;
+	_BitScanReverse64(&r, x);
+	return static_cast<int>(r);
+}
+_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
+{
+   DWORD r = 0;
+   _BitScanForward(&r, x);
+   return static_cast<int>(r);
+}
+// sizeof(long) == sizeof(int) on Windows
+_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
+{ return __builtin_clz( static_cast<int>(x) ); }
+_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
+{
+    DWORD r = 0;
+	_BitScanForward64(&r, x);
+	return static_cast<int>(r);
+}
+
+#endif
 
 #endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
\ No newline at end of file

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Sat Oct 22 15:59:45 2011
@@ -307,7 +307,14 @@
 #endif
 }
 
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4231 )
+#endif // _MSC_VER
 extern template class __vector_base_common<true>;
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif // _MSC_VER
 
 template <class _Tp, class _Allocator>
 class __vector_base

Modified: libcxx/trunk/src/support/win32/support.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/win32/support.cpp?rev=142732&r1=142731&r2=142732&view=diff
==============================================================================
--- libcxx/trunk/src/support/win32/support.cpp (original)
+++ libcxx/trunk/src/support/win32/support.cpp Sat Oct 22 15:59:45 2011
@@ -15,7 +15,7 @@
 #include <stdio.h>  // vsprintf, vsnprintf
 #include <string.h> // strcpy, wcsncpy
 
-int asprintf(char **sptr, const char *__restrict__ fmt, ...)
+int asprintf(char **sptr, const char *__restrict fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -23,7 +23,7 @@
     va_end(ap);
     return result;
 }
-int vasprintf( char **sptr, const char *__restrict__ fmt, va_list ap )
+int vasprintf( char **sptr, const char *__restrict fmt, va_list ap )
 {
     *sptr = NULL;
     int count = vsnprintf( *sptr, 0, fmt, ap );
@@ -38,8 +38,8 @@
 
 // FIXME: use wcrtomb and avoid copy
 // use mbsrtowcs which is available, first copy first nwc elements of src
-size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
-                   size_t nmc, size_t len, mbstate_t *__restrict__ ps )
+size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
+                   size_t nmc, size_t len, mbstate_t *__restrict ps )
 {
     char* local_src = new char[nmc+1];
     char* nmcsrc = local_src;
@@ -54,8 +54,8 @@
 }
 // FIXME: use wcrtomb and avoid copy
 // use wcsrtombs which is available, first copy first nwc elements of src
-size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
-                   size_t nwc, size_t len, mbstate_t *__restrict__ ps )
+size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
+                   size_t nwc, size_t len, mbstate_t *__restrict ps )
 {
     wchar_t* local_src = new wchar_t[nwc];
     wchar_t* nwcsrc = local_src;





More information about the cfe-commits mailing list