Skip to content

Commit

Permalink
Import new version of libc++. Among other improvements, this comes wi…
Browse files Browse the repository at this point in the history
…th an

<atomic> header that works with clang 3.1 (and, importantly, the pre-3.1
snapshot currently in head)
  • Loading branch information
davidchisnall committed May 3, 2012
1 parent 72d6cdc commit 011d800
Show file tree
Hide file tree
Showing 15 changed files with 1,071 additions and 1,036 deletions.
4 changes: 3 additions & 1 deletion contrib/libc++/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ template <unsigned> struct __static_assert_check {};
#endif

#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define constexpr const
#define _LIBCPP_CONSTEXPR
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif

#ifndef __has_feature
Expand Down
29 changes: 28 additions & 1 deletion contrib/libc++/include/__tuple
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_constructible<_Up0, _Tp0>::value &&
is_convertible<_Tp0, _Up0>::value &&
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};

template <>
Expand All @@ -235,6 +235,33 @@ struct __tuple_convertible<_Tp, _Up, true, true>
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};

// __tuple_constructible

template <bool, class _Tp, class _Up>
struct __tuple_constructible_imp : public false_type {};

template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_constructible<_Up0, _Tp0>::value &&
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};

template <>
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};

template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_constructible
: public false_type {};

template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};

// __tuple_assignable

template <bool, class _Tp, class _Up>
Expand Down
17 changes: 11 additions & 6 deletions contrib/libc++/include/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -2508,11 +2508,16 @@ private:
_Engine_result_type __mask0_;
_Engine_result_type __mask1_;

#ifdef _LIBCPP_HAS_NO_CONSTEXPR
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
static const size_t __m = __log2<_Working_result_type, _Rp>::value;
static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
+ _Working_result_type(1);
#else
static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
+ _Working_result_type(1);
#endif
static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;

public:
// constructors and seeding functions
Expand Down Expand Up @@ -2712,8 +2717,8 @@ public:

result_type operator()();

static constexpr result_type min() {return _Min;}
static constexpr result_type max() {return _Max;}
static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
static _LIBCPP_CONSTEXPR result_type max() {return _Max;}

friend __rs_default __rs_get();
};
Expand Down
722 changes: 361 additions & 361 deletions contrib/libc++/include/atomic

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions contrib/libc++/include/cmath
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,17 @@ using ::double_t;

// abs

template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, _A1>::type
abs(_A1 __x) {return fabs(__x);}
float
abs(float __x) {return fabsf(__x);}

inline _LIBCPP_INLINE_VISIBILITY
double
abs(double __x) {return fabs(__x);}

inline _LIBCPP_INLINE_VISIBILITY
long double
abs(long double __x) {return fabsl(__x);}

#ifndef __sun__

Expand Down
Loading

0 comments on commit 011d800

Please sign in to comment.