Commit b82f782b by Benjamin Kosnik

PR libstdc++/19664 round 3

2006-07-27  Benjamin Kosnik  <bkoz@wells.artheist.org>

	PR libstdc++/19664 round 3	
	* include/Makefile.am (tr1_headers): Add hashtable_policy.h.
	* include/Makefile.in: Regenerate.
	* include/tr1/hashtable: Move policy classes into...
	* include/tr1/hashtable_policy.h: ... this. New.
	
	* src/globals_locale.cc: Move contents....
	* src/locale_init.cc: ... to here, put in anonymous namespace.
	* src/Makefile.am: Remove globals_locale.cc.
	* src/Makefile.in: Regenerate.

	* src/locale.cc: Convert __gnu_internal to anonymous namespace.
	* src/debug.cc: Same.
	* src/ext-inst.cc: Same.
	* src/mt_allocator.cc: Same.
	* src/pool_allocator.cc: Same.
	
	* include/tr1/random: Convert std::tr1::_Private to anonymous
	namespace.
	* include/tr1/random.tcc: Same.

	* include/tr1/hashtable: Move ::Internal to std::tr1::detail and
	enclose bits that can actually be internal in in anonymous
	namespace.
	* include/tr1/unordered_set: Adjust explicit qualifications for
	namespace changes.
	* include/tr1/unordered_map: Same.

	* include/tr1/cmath: Convert __gnu_internal to nested detail namespace.

	* include/bits/cpp_type_traits.h: Move __type_type into anonymous
	namespace.
	
	* include/ext/rope: Change _Rope_constants to anonymous namespace.
	* include/ext/ropeimpl.h: Same.
	* src/ext-inst.cc: Same.

From-SVN: r115790
parent 85661c41
2006-07-27 Benjamin Kosnik <bkoz@wells.artheist.org>
PR libstdc++/19664 round 3
* include/Makefile.am (tr1_headers): Add hashtable_policy.h.
* include/Makefile.in: Regenerate.
* include/tr1/hashtable: Move policy classes into...
* include/tr1/hashtable_policy.h: ... this. New.
* src/globals_locale.cc: Move contents....
* src/locale_init.cc: ... to here, put in anonymous namespace.
* src/Makefile.am: Remove globals_locale.cc.
* src/Makefile.in: Regenerate.
* src/locale.cc: Convert __gnu_internal to anonymous namespace.
* src/debug.cc: Same.
* src/ext-inst.cc: Same.
* src/mt_allocator.cc: Same.
* src/pool_allocator.cc: Same.
* include/tr1/random: Convert std::tr1::_Private to anonymous
namespace.
* include/tr1/random.tcc: Same.
* include/tr1/hashtable: Move ::Internal to std::tr1::detail and
enclose bits that can actually be internal in in anonymous
namespace.
* include/tr1/unordered_set: Adjust explicit qualifications for
namespace changes.
* include/tr1/unordered_map: Same.
* include/tr1/cmath: Convert __gnu_internal to nested detail namespace.
* include/bits/cpp_type_traits.h: Move __type_type into anonymous
namespace.
* include/ext/rope: Change _Rope_constants to anonymous namespace.
* include/ext/ropeimpl.h: Same.
* src/ext-inst.cc: Same.
2006-07-24 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cinttypes: Simply protect everything with
......@@ -31,6 +70,7 @@
2006-07-21 Jason Merrill <jason@redhat.com>
PR libstdc++/19664 round 2
* libsupc++/eh_personality.cc: Wrap extern "C" function
definitions in namespace __cxxabiv1.
......
......@@ -591,6 +591,7 @@ tr1_headers = \
${tr1_srcdir}/functional \
${tr1_srcdir}/functional_iterate.h \
${tr1_srcdir}/hashtable \
${tr1_srcdir}/hashtable_policy.h \
${tr1_srcdir}/inttypes.h \
${tr1_srcdir}/limits.h \
${tr1_srcdir}/math.h \
......
......@@ -811,6 +811,7 @@ tr1_headers = \
${tr1_srcdir}/functional \
${tr1_srcdir}/functional_iterate.h \
${tr1_srcdir}/hashtable \
${tr1_srcdir}/hashtable_policy.h \
${tr1_srcdir}/inttypes.h \
${tr1_srcdir}/limits.h \
${tr1_srcdir}/math.h \
......
......@@ -70,19 +70,6 @@
// removed.
//
// NB: g++ can not compile these if declared within the class
// __is_pod itself.
namespace __gnu_internal
{
typedef char __one;
typedef char __two[2];
template<typename _Tp>
__one __test_type(int _Tp::*);
template<typename _Tp>
__two& __test_type(...);
} // namespace __gnu_internal
// Forward declaration hack, should really include this from somewhere.
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
......@@ -352,16 +339,27 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
: public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
{ };
//
// For the immediate use, the following is a good approximation
//
// NB: g++ can not compile these if declared within the class
// __is_pod itself.
namespace
{
typedef char __one;
typedef char __two[2];
template<typename _Tp>
__one __test_type(int _Tp::*);
template<typename _Tp>
__two& __test_type(...);
}
// For the immediate use, the following is a good approximation.
template<typename _Tp>
struct __is_pod
{
enum
{
__value = (sizeof(__gnu_internal::__test_type<_Tp>(0))
!= sizeof(__gnu_internal::__one))
__value = (sizeof(__test_type<_Tp>(0)) != sizeof(__one))
};
};
......
// SGI's rope class -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -66,6 +67,12 @@
#include <ext/memory> // For uninitialized_copy_n
namespace
{
enum { _S_max_rope_depth = 45 };
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
}
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using std::size_t;
......@@ -543,12 +550,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
# undef __ROPE_DEFINE_ALLOC
};
namespace _Rope_constants
{
enum { _S_max_rope_depth = 45 };
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
}
template<class _CharT, class _Alloc>
struct _Rope_RopeRep
: public _Rope_rep_base<_CharT, _Alloc>
......@@ -557,7 +558,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
# endif
{
public:
_Rope_constants::_Tag _M_tag:8;
_Tag _M_tag:8;
bool _M_is_balanced:8;
unsigned char _M_depth;
__GC_CONST _CharT* _M_c_string;
......@@ -573,7 +574,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
_Rope_RopeRep(_Rope_constants::_Tag __t, int __d, bool __b, size_t __size,
_Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size,
allocator_type __a)
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
#ifndef __GC
......@@ -690,7 +691,7 @@ protected:
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
allocator_type __a)
: _Rope_RopeRep<_CharT, _Alloc>(_Rope_constants::_S_leaf, 0, true,
: _Rope_RopeRep<_CharT, _Alloc>(_S_leaf, 0, true,
__size, __a), _M_data(__d)
{
if (_S_is_basic_char_type((_CharT *)0))
......@@ -732,7 +733,7 @@ protected:
_Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
_Rope_RopeRep<_CharT, _Alloc>* __r,
allocator_type __a)
: _Rope_RopeRep<_CharT, _Alloc>(_Rope_constants::_S_concat,
: _Rope_RopeRep<_CharT, _Alloc>(::_S_concat,
std::max(__l->_M_depth,
__r->_M_depth) + 1,
false,
......@@ -780,8 +781,7 @@ protected:
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
bool __d, allocator_type __a)
: _Rope_RopeRep<_CharT, _Alloc>(_Rope_constants::_S_function,
0, true, __size, __a)
: _Rope_RopeRep<_CharT, _Alloc>(::_S_function, 0, true, __size, __a)
, _M_fn(__f)
#ifndef __GC
, _M_delete_when_done(__d)
......@@ -832,15 +832,15 @@ protected:
{
switch(_M_base->_M_tag)
{
case _Rope_constants::_S_function:
case _Rope_constants::_S_substringfn:
case ::_S_function:
case ::_S_substringfn:
{
char_producer<_CharT>* __fn =
((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
(*__fn)(__start_pos + _M_start, __req_len, __buffer);
}
break;
case _Rope_constants::_S_leaf:
case ::_S_leaf:
{
__GC_CONST _CharT* __s =
((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
......@@ -864,7 +864,7 @@ protected:
#ifndef __GC
_M_base->_M_ref_nonnil();
#endif
this->_M_tag = _Rope_constants::_S_substringfn;
this->_M_tag = ::_S_substringfn;
}
virtual ~_Rope_RopeSubstring() throw()
{
......@@ -1711,7 +1711,7 @@ protected:
_CharT* __buffer);
static const unsigned long
_S_min_len[_Rope_constants::_S_max_rope_depth + 1];
_S_min_len[::_S_max_rope_depth + 1];
static bool
_S_is_balanced(_RopeRep* __r)
......@@ -1961,7 +1961,7 @@ protected:
{
if (0 == this->_M_tree_ptr)
return;
if (_Rope_constants::_S_leaf == this->_M_tree_ptr->_M_tag &&
if (::_S_leaf == this->_M_tree_ptr->_M_tag &&
((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
this->_M_tree_ptr->_M_c_string)
{
......@@ -2013,7 +2013,7 @@ protected:
size_type
max_size() const
{
return _S_min_len[int(_Rope_constants::_S_max_rope_depth) - 1] - 1;
return _S_min_len[int(::_S_max_rope_depth) - 1] - 1;
// Guarantees that the result can be sufficirntly
// balanced. Longer ropes will probably still work,
// but it's harder to make guarantees.
......@@ -2089,8 +2089,8 @@ protected:
_Self_destruct_ptr __appendee(_S_substring(__s._M_root,
__s._M_current_pos,
__e._M_current_pos));
_RopeRep* __result =
_S_concat(this->_M_tree_ptr, (_RopeRep*)__appendee);
_RopeRep* __result = _S_concat(this->_M_tree_ptr,
(_RopeRep*)__appendee);
_S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result;
return *this;
......
......@@ -146,21 +146,6 @@
#undef truncf
#undef truncl
// Workaround for c++/21682.
namespace __gnu_internal
{
template<typename _Tp, typename _Up>
inline typename
std::__enable_if<typename std::tr1::__promote_2<_Tp, _Up>::__type,
(std::__is_floating<_Tp>::__value
|| std::__is_floating<_Up>::__value)>::__type
atan2(_Tp __y, _Up __x)
{
typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type;
return std::atan2(__type(__y), __type(__x));
}
}
#endif
// namespace std::tr1
......@@ -381,10 +366,24 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
}
using std::atan;
using std::atan2;
// Workaround for c++/21682.
using __gnu_internal::atan2;
namespace detail
{
template<typename _Tp, typename _Up>
inline typename
std::__enable_if<typename std::tr1::__promote_2<_Tp, _Up>::__type,
(std::__is_floating<_Tp>::__value
|| std::__is_floating<_Up>::__value)>::__type
atan2(_Tp __y, _Up __x)
{
typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type;
return std::atan2(__type(__y), __type(__x));
}
} // namespace detail
using std::atan2;
using detail::atan2;
inline float
atanh(float __x)
......
......@@ -61,7 +61,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
/*
* Implementation-space details.
*/
namespace _Private
namespace
{
// Type selectors -- are these already implemented elsewhere?
template<bool, typename _TpTrue, typename _TpFalse>
......@@ -76,6 +76,16 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
typedef _TpFalse _Type;
};
template<typename _UIntType, int __w, bool =
__w < std::numeric_limits<_UIntType>::digits>
struct _Shift
{ static const _UIntType __value = 0; };
template<typename _UIntType, int __w>
struct _Shift<_UIntType, __w, true>
{ static const _UIntType __value = _UIntType(1) << __w; };
} // anonymous namespace
/*
* An adaptor class for converting the output of any Generator into
* the input for a specific Distribution.
......@@ -124,17 +134,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return __return_value;
}
template<typename _UIntType, int __w, bool =
__w < std::numeric_limits<_UIntType>::digits>
struct _Shift
{ static const _UIntType __value = 0; };
template<typename _UIntType, int __w>
struct _Shift<_UIntType, __w, true>
{ static const _UIntType __value = _UIntType(1) << __w; };
} // namespace std::tr1::_Private
/**
* Produces random numbers on a given disribution function using a un uniform
......@@ -152,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
public:
typedef _Engine engine_type;
typedef _Private::_Adaptor<_Engine, _Dist> engine_value_type;
typedef _Adaptor<_Engine, _Dist> engine_value_type;
typedef _Dist distribution_type;
typedef typename _Dist::result_type result_type;
......@@ -364,8 +363,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
operator()();
/**
* Compares two linear congruential random number generator objects of the
* same type for equality.
* Compares two linear congruential random number generator
* objects of the same type for equality.
*
* @param __lhs A linear congruential random number generator object.
* @param __rhs Another linear congruential random number generator obj.
......@@ -378,8 +377,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{ return __lhs._M_x == __rhs._M_x; }
/**
* Compares two linear congruential random number generator objects of the
* same type for inequality.
* Compares two linear congruential random number generator
* objects of the same type for inequality.
*
* @param __lhs A linear congruential random number generator object.
* @param __rhs Another linear congruential random number generator obj.
......@@ -553,7 +552,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
result_type
max() const
{ return _Private::_Shift<_UIntType, __w>::__value - 1; }
{ return _Shift<_UIntType, __w>::__value - 1; }
result_type
operator()();
......@@ -1116,8 +1115,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
public:
/** The type of the generated random value. */
typedef typename _Private::_Select<
(sizeof(_Result_type1) > sizeof(_Result_type2)),
typedef typename _Select<(sizeof(_Result_type1) > sizeof(_Result_type2)),
_Result_type1, _Result_type2>::_Type result_type;
// parameter values
......
......@@ -34,7 +34,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
/*
* Implementation-space details.
*/
namespace _Private
namespace
{
// General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid
// integer overflow.
......@@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{ typedef unsigned long long _Type; };
#endif
} // namespace _Private
} // anonymous namespace
/**
......@@ -136,11 +136,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
linear_congruential<_UIntType, __a, __c, __m>::
seed(unsigned long __x0)
{
if ((_Private::__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (_Private::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = _Private::__mod<_UIntType, 1, 0, __m>(1);
if ((__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = __mod<_UIntType, 1, 0, __m>(1);
else
_M_x = _Private::__mod<_UIntType, 1, 0, __m>(__x0);
_M_x = __mod<_UIntType, 1, 0, __m>(__x0);
}
/**
......@@ -153,11 +153,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
seed(_Gen& __g, false_type)
{
_UIntType __x0 = __g();
if ((_Private::__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (_Private::__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = _Private::__mod<_UIntType, 1, 0, __m>(1);
if ((__mod<_UIntType, 1, 0, __m>(__c) == 0)
&& (__mod<_UIntType, 1, 0, __m>(__x0) == 0))
_M_x = __mod<_UIntType, 1, 0, __m>(1);
else
_M_x = _Private::__mod<_UIntType, 1, 0, __m>(__x0);
_M_x = __mod<_UIntType, 1, 0, __m>(__x0);
}
/**
......@@ -172,7 +172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
typename linear_congruential<_UIntType, __a, __c, __m>::result_type
linear_congruential<_UIntType, __a, __c, __m>::
min() const
{ return (_Private::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
{ return (__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
/**
* Gets the maximum possible value of the generated range.
......@@ -193,7 +193,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
linear_congruential<_UIntType, __a, __c, __m>::
operator()()
{
_M_x = _Private::__mod<_UIntType, __a, __c, __m>(_M_x);
_M_x = __mod<_UIntType, __a, __c, __m>(_M_x);
return _M_x;
}
......@@ -240,8 +240,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
__b, __t, __c, __l>::
seed(unsigned long __value)
{
_M_x[0] = _Private::__mod<_UIntType, 1, 0,
_Private::_Shift<_UIntType, __w>::__value>(__value);
_M_x[0] = __mod<_UIntType, 1, 0,
_Shift<_UIntType, __w>::__value>(__value);
for (int __i = 1; __i < state_size; ++__i)
{
......@@ -249,8 +249,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
__x ^= __x >> (__w - 2);
__x *= 1812433253ul;
__x += __i;
_M_x[__i] = _Private::__mod<_UIntType, 1, 0,
_Private::_Shift<_UIntType, __w>::__value>(__x);
_M_x[__i] = __mod<_UIntType, 1, 0,
_Shift<_UIntType, __w>::__value>(__x);
}
_M_p = state_size;
}
......@@ -265,8 +265,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
seed(_Gen& __gen, false_type)
{
for (int __i = 0; __i < state_size; ++__i)
_M_x[__i] = _Private::__mod<_UIntType, 1, 0,
_Private::_Shift<_UIntType, __w>::__value>(__gen());
_M_x[__i] = __mod<_UIntType, 1, 0,
_Shift<_UIntType, __w>::__value>(__gen());
_M_p = state_size;
}
......@@ -376,7 +376,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
__lcg(__value);
for (int __i = 0; __i < long_lag; ++__i)
_M_x[__i] = _Private::__mod<_IntType, 1, 0, modulus>(__lcg());
_M_x[__i] = __mod<_IntType, 1, 0, modulus>(__lcg());
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
......@@ -390,10 +390,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
{
const int __n = (std::numeric_limits<_IntType>::digits + 31) / 32;
typedef typename _Private::_Select<(sizeof(unsigned) == 4),
typedef typename _Select<(sizeof(unsigned) == 4),
unsigned, unsigned long>::_Type _UInt32Type;
typedef typename _Private::_To_Unsigned_Type<_IntType>::_Type
typedef typename _To_Unsigned_Type<_IntType>::_Type
_UIntType;
for (int __i = 0; __i < long_lag; ++__i)
......@@ -402,11 +402,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
_UIntType __factor = 1;
for (int __j = 0; __j < __n; ++__j)
{
__tmp += (_Private::__mod<_UInt32Type, 1, 0, 0>(__gen())
__tmp += (__mod<_UInt32Type, 1, 0, 0>(__gen())
* __factor);
__factor *= _Private::_Shift<_UIntType, 32>::__value;
__factor *= _Shift<_UIntType, 32>::__value;
}
_M_x[__i] = _Private::__mod<_UIntType, 1, 0, modulus>(__tmp);
_M_x[__i] = __mod<_UIntType, 1, 0, modulus>(__tmp);
}
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
......@@ -622,7 +622,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const std::streamsize __precision = __os.precision();
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(_Private::_Max_digits10<double>::__value);
__os.precision(_Max_digits10<double>::__value);
__os << __x.p();
......@@ -644,7 +644,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const std::streamsize __precision = __os.precision();
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(_Private::_Max_digits10<_RealType>::__value);
__os.precision(_Max_digits10<_RealType>::__value);
__os << __x.p();
......@@ -666,7 +666,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const _CharT __space = __os.widen(' ');
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__space);
__os.precision(_Private::_Max_digits10<_RealType>::__value);
__os.precision(_Max_digits10<_RealType>::__value);
__os << __x.min() << __space << __x.max();
......@@ -701,7 +701,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const std::streamsize __precision = __os.precision();
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(_Private::_Max_digits10<_RealType>::__value);
__os.precision(_Max_digits10<_RealType>::__value);
__os << __x.lambda();
......@@ -764,7 +764,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const _CharT __space = __os.widen(' ');
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__space);
__os.precision(_Private::_Max_digits10<_RealType>::__value);
__os.precision(_Max_digits10<_RealType>::__value);
__os << __x.mean() << __space
<< __x.sigma() << __space
......@@ -872,7 +872,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const std::streamsize __precision = __os.precision();
__os.flags(std::ios_base::scientific | std::ios_base::left);
__os.fill(__os.widen(' '));
__os.precision(_Private::_Max_digits10<_RealType>::__value);
__os.precision(_Max_digits10<_RealType>::__value);
__os << __x.alpha();
......
......@@ -43,29 +43,26 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
// XXX When we get typedef templates these class definitions
// will be unnecessary.
template<class Key, class T,
class Hash = hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<std::pair<const Key, T> >,
bool cache_hash_code = false>
class unordered_map
: public hashtable <Key, std::pair<const Key, T>,
Alloc,
Internal::extract1st<std::pair<const Key, T> >, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, true>
: public hashtable<Key, std::pair<const Key, T>, Alloc,
detail::extract1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, false, true>
{
typedef hashtable <Key, std::pair<const Key, T>,
Alloc,
Internal::extract1st<std::pair<const Key, T> >, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
cache_hash_code, false, true>
Base;
typedef hashtable<Key, std::pair<const Key, T>, Alloc,
detail::extract1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, false, true>
Base;
public:
typedef typename Base::size_type size_type;
......@@ -78,9 +75,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base(n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::extract1st<std::pair<const Key, T> >(), a)
: Base(n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::extract1st<std::pair<const Key, T> >(), a)
{ }
template<typename InputIterator>
......@@ -89,9 +86,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::extract1st<std::pair<const Key, T> >(), a)
: Base (f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::extract1st<std::pair<const Key, T> >(), a)
{ }
};
......@@ -103,18 +100,18 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
class unordered_multimap
: public hashtable <Key, std::pair<const Key, T>,
Alloc,
Internal::extract1st<std::pair<const Key, T> >, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::extract1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, false, false>
{
typedef hashtable <Key, std::pair<const Key, T>,
Alloc,
Internal::extract1st<std::pair<const Key, T> >, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::extract1st<std::pair<const Key, T> >, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, false, false>
Base;
......@@ -129,9 +126,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::extract1st<std::pair<const Key, T> >(), a)
: Base (n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::extract1st<std::pair<const Key, T> >(), a)
{ }
......@@ -141,9 +138,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::extract1st<std::pair<const Key, T> >(), a)
: Base (f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::extract1st<std::pair<const Key, T> >(), a)
{ }
};
......
......@@ -43,7 +43,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
// XXX When we get typedef templates these class definitions
// will be unnecessary.
template<class Value,
class Hash = hash<Value>,
class Pred = std::equal_to<Value>,
......@@ -51,17 +50,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
bool cache_hash_code = false>
class unordered_set
: public hashtable<Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, true>
{
typedef hashtable<Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, true>
Base;
......@@ -76,9 +75,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::identity<Value>(), a)
: Base(n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::identity<Value>(), a)
{ }
template<typename InputIterator>
......@@ -87,9 +86,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::identity<Value>(), a)
: Base(f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::identity<Value>(), a)
{ }
};
......@@ -100,17 +99,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
bool cache_hash_code = false>
class unordered_multiset
: public hashtable <Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, false>
{
typedef hashtable<Value, Value, Alloc,
Internal::identity<Value>, Pred,
Hash, Internal::mod_range_hashing,
Internal::default_ranged_hash,
Internal::prime_rehash_policy,
detail::identity<Value>, Pred,
Hash, detail::mod_range_hashing,
detail::default_ranged_hash,
detail::prime_rehash_policy,
cache_hash_code, true, false>
Base;
......@@ -125,9 +124,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(),
eql, Internal::identity<Value>(), a)
: Base(n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(),
eql, detail::identity<Value>(), a)
{ }
......@@ -137,9 +136,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
const hasher& hf = hasher(),
const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type())
: Base (f, l, n, hf, Internal::mod_range_hashing(),
Internal::default_ranged_hash(), eql,
Internal::identity<Value>(), a)
: Base(f, l, n, hf, detail::mod_range_hashing(),
detail::default_ranged_hash(), eql,
detail::identity<Value>(), a)
{ }
};
......
......@@ -138,7 +138,6 @@ sources = \
debug.cc \
debug_list.cc \
functexcept.cc \
globals_locale.cc \
globals_io.cc \
ios.cc \
ios_failure.cc \
......
......@@ -62,19 +62,19 @@ toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \
mt_allocator.cc codecvt.cc compatibility.cc complex_io.cc \
ctype.cc debug.cc debug_list.cc functexcept.cc \
globals_locale.cc globals_io.cc ios.cc ios_failure.cc \
ios_init.cc ios_locale.cc limits.cc list.cc locale.cc \
locale_init.cc locale_facets.cc localename.cc stdexcept.cc \
strstream.cc tree.cc allocator-inst.cc concept-inst.cc \
fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \
istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \
ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \
string-inst.cc valarray-inst.cc wlocale-inst.cc \
wstring-inst.cc atomicity.cc codecvt_members.cc \
collate_members.cc ctype_members.cc messages_members.cc \
monetary_members.cc numeric_members.cc time_members.cc \
basic_file.cc c++locale.cc compatibility-ldbl.cc
ctype.cc debug.cc debug_list.cc functexcept.cc globals_io.cc \
ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \
list.cc locale.cc locale_init.cc locale_facets.cc \
localename.cc stdexcept.cc strstream.cc tree.cc \
allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \
ios-inst.cc iostream-inst.cc istream-inst.cc istream.cc \
locale-inst.cc misc-inst.cc ostream-inst.cc sstream-inst.cc \
streambuf-inst.cc streambuf.cc string-inst.cc valarray-inst.cc \
wlocale-inst.cc wstring-inst.cc atomicity.cc \
codecvt_members.cc collate_members.cc ctype_members.cc \
messages_members.cc monetary_members.cc numeric_members.cc \
time_members.cc basic_file.cc c++locale.cc \
compatibility-ldbl.cc
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
numeric_members.lo time_members.lo
......@@ -82,16 +82,16 @@ am__objects_2 = basic_file.lo c++locale.lo
@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_3 = compatibility-ldbl.lo
am__objects_4 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
codecvt.lo compatibility.lo complex_io.lo ctype.lo debug.lo \
debug_list.lo functexcept.lo globals_locale.lo globals_io.lo \
ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
list.lo locale.lo locale_init.lo locale_facets.lo \
localename.lo stdexcept.lo strstream.lo tree.lo \
allocator-inst.lo concept-inst.lo fstream-inst.lo ext-inst.lo \
ios-inst.lo iostream-inst.lo istream-inst.lo istream.lo \
locale-inst.lo misc-inst.lo ostream-inst.lo sstream-inst.lo \
streambuf-inst.lo streambuf.lo string-inst.lo valarray-inst.lo \
wlocale-inst.lo wstring-inst.lo $(am__objects_1) \
$(am__objects_2) $(am__objects_3)
debug_list.lo functexcept.lo globals_io.lo ios.lo \
ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \
locale.lo locale_init.lo locale_facets.lo localename.lo \
stdexcept.lo strstream.lo tree.lo allocator-inst.lo \
concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \
iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \
misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo \
wstring-inst.lo $(am__objects_1) $(am__objects_2) \
$(am__objects_3)
am_libstdc___la_OBJECTS = $(am__objects_4)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
......@@ -344,7 +344,6 @@ sources = \
debug.cc \
debug_list.cc \
functexcept.cc \
globals_locale.cc \
globals_io.cc \
ios.cc \
ios_failure.cc \
......
......@@ -39,10 +39,10 @@
using namespace std;
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
static __glibcxx_mutex_define_initialized(iterator_base_mutex);
} // namespace __gnu_internal
}
namespace __gnu_debug
{
......@@ -192,7 +192,7 @@ namespace __gnu_debug
// Attach to the new sequence (if there is one)
if (__seq)
{
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
__gnu_cxx::lock sentry(iterator_base_mutex);
_M_sequence = __seq;
_M_version = _M_sequence->_M_version;
_M_prior = 0;
......@@ -217,7 +217,7 @@ namespace __gnu_debug
_Safe_iterator_base::
_M_detach()
{
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
__gnu_cxx::lock sentry(iterator_base_mutex);
if (_M_sequence)
{
// Remove us from this sequence's list
......
......@@ -34,15 +34,13 @@
#include <ext/rope>
#include <ext/stdio_filebuf.h>
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
const int min_len = __gnu_cxx::_Rope_constants::_S_max_rope_depth + 1;
const int min_len = _S_max_rope_depth + 1;
}
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
using namespace __gnu_internal;
template
const unsigned long
rope<char, std::allocator<char> >::_S_min_len[min_len];
......
// Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <locale>
// On AIX, and perhaps other systems, library initialization order is
// not guaranteed. For example, the static initializers for the main
// program might run before the static initializers for this library.
// That means that we cannot rely on static initialization in the
// library; there is no guarantee that things will get initialized in
// time. This file contains definitions of all global variables that
// require initialization as arrays of characters.
// NB: asm directives can rename these non-exported, namespace
// __gnu_cxx symbols into exported, namespace std symbols with the
// appropriate symbol version name.
// The rename syntax is
// asm (".symver currentname,oldname@@GLIBCXX_3.2")
// In macro form:
// _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
{
using namespace std;
typedef char fake_locale_Impl[sizeof(locale::_Impl)]
__attribute__ ((aligned(__alignof__(locale::_Impl))));
fake_locale_Impl c_locale_impl;
typedef char fake_locale[sizeof(locale)]
__attribute__ ((aligned(__alignof__(locale))));
fake_locale c_locale;
typedef char fake_name_vec[sizeof(char*)]
__attribute__ ((aligned(__alignof__(char*))));
fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
typedef char fake_names[sizeof(char[2])]
__attribute__ ((aligned(__alignof__(char[2]))));
fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES];
typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
typedef char fake_cache_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS];
typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>))));
fake_ctype_c ctype_c;
typedef char fake_collate_c[sizeof(std::collate<char>)]
__attribute__ ((aligned(__alignof__(std::collate<char>))));
fake_collate_c collate_c;
typedef char fake_numpunct_c[sizeof(numpunct<char>)]
__attribute__ ((aligned(__alignof__(numpunct<char>))));
fake_numpunct_c numpunct_c;
typedef char fake_num_get_c[sizeof(num_get<char>)]
__attribute__ ((aligned(__alignof__(num_get<char>))));
fake_num_get_c num_get_c;
typedef char fake_num_put_c[sizeof(num_put<char>)]
__attribute__ ((aligned(__alignof__(num_put<char>))));
fake_num_put_c num_put_c;
typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
fake_codecvt_c codecvt_c;
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_ct;
fake_moneypunct_c moneypunct_cf;
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
fake_money_get_c money_get_c;
typedef char fake_money_put_c[sizeof(money_put<char>)]
__attribute__ ((aligned(__alignof__(money_put<char>))));
fake_money_put_c money_put_c;
typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
__attribute__ ((aligned(__alignof__(__timepunct<char>))));
fake_timepunct_c timepunct_c;
typedef char fake_time_get_c[sizeof(time_get<char>)]
__attribute__ ((aligned(__alignof__(time_get<char>))));
fake_time_get_c time_get_c;
typedef char fake_time_put_c[sizeof(time_put<char>)]
__attribute__ ((aligned(__alignof__(time_put<char>))));
fake_time_put_c time_put_c;
typedef char fake_messages_c[sizeof(messages<char>)]
__attribute__ ((aligned(__alignof__(messages<char>))));
fake_messages_c messages_c;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
fake_wtype_w ctype_w;
typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
fake_wollate_w collate_w;
typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
fake_numpunct_w numpunct_w;
typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
fake_num_get_w num_get_w;
typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
fake_num_put_w num_put_w;
typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
fake_wodecvt_w codecvt_w;
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_wt;
fake_moneypunct_w moneypunct_wf;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
fake_money_get_w money_get_w;
typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
fake_money_put_w money_put_w;
typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
fake_timepunct_w timepunct_w;
typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
fake_time_get_w time_get_w;
typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
fake_time_put_w time_put_w;
typedef char fake_messages_w[sizeof(messages<wchar_t>)]
__attribute__ ((aligned(__alignof__(messages<wchar_t>))));
fake_messages_w messages_w;
#endif
// Storage for "C" locale caches.
typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
fake_num_cache_c numpunct_cache_c;
typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>))));
fake_money_cache_c moneypunct_cache_ct;
fake_money_cache_c moneypunct_cache_cf;
typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
fake_time_cache_c timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
fake_num_cache_w numpunct_cache_w;
typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>))));
fake_money_cache_w moneypunct_cache_wt;
fake_money_cache_w moneypunct_cache_wf;
typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
fake_time_cache_w timepunct_cache_w;
#endif
} // namespace __gnu_internal
......@@ -35,9 +35,9 @@
#include <bits/atomicity.h>
#include <bits/concurrence.h>
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
// Mutex object for cache access
// Mutex object for cache access.
static __glibcxx_mutex_define_initialized(locale_cache_mutex);
}
......@@ -391,7 +391,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
locale::_Impl::
_M_install_cache(const facet* __cache, size_t __index)
{
__gnu_cxx::lock sentry(__gnu_internal::locale_cache_mutex);
__gnu_cxx::lock sentry(locale_cache_mutex);
if (_M_caches[__index] != 0)
{
// Some other thread got in first.
......
......@@ -35,72 +35,181 @@
#include <bits/atomicity.h>
#include <bits/concurrence.h>
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
// Defined in globals.cc.
extern std::locale c_locale;
extern std::locale::_Impl c_locale_impl;
extern std::locale::facet* facet_vec[_GLIBCXX_NUM_FACETS];
extern char* name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
extern char name_c[6 + _GLIBCXX_NUM_CATEGORIES][2];
extern std::ctype<char> ctype_c;
extern std::collate<char> collate_c;
extern std::numpunct<char> numpunct_c;
extern std::num_get<char> num_get_c;
extern std::num_put<char> num_put_c;
extern std::codecvt<char, char, mbstate_t> codecvt_c;
extern std::moneypunct<char, false> moneypunct_cf;
extern std::moneypunct<char, true> moneypunct_ct;
extern std::money_get<char> money_get_c;
extern std::money_put<char> money_put_c;
extern std::__timepunct<char> timepunct_c;
extern std::time_get<char> time_get_c;
extern std::time_put<char> time_put_c;
extern std::messages<char> messages_c;
using namespace std;
typedef char fake_locale_Impl[sizeof(locale::_Impl)]
__attribute__ ((aligned(__alignof__(locale::_Impl))));
fake_locale_Impl c_locale_impl;
typedef char fake_locale[sizeof(locale)]
__attribute__ ((aligned(__alignof__(locale))));
fake_locale c_locale;
typedef char fake_name_vec[sizeof(char*)]
__attribute__ ((aligned(__alignof__(char*))));
fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
typedef char fake_names[sizeof(char[2])]
__attribute__ ((aligned(__alignof__(char[2]))));
fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES];
typedef char fake_facet_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
typedef char fake_cache_vec[sizeof(locale::facet*)]
__attribute__ ((aligned(__alignof__(locale::facet*))));
fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS];
typedef char fake_ctype_c[sizeof(std::ctype<char>)]
__attribute__ ((aligned(__alignof__(std::ctype<char>))));
fake_ctype_c ctype_c;
typedef char fake_collate_c[sizeof(std::collate<char>)]
__attribute__ ((aligned(__alignof__(std::collate<char>))));
fake_collate_c collate_c;
typedef char fake_numpunct_c[sizeof(numpunct<char>)]
__attribute__ ((aligned(__alignof__(numpunct<char>))));
fake_numpunct_c numpunct_c;
typedef char fake_num_get_c[sizeof(num_get<char>)]
__attribute__ ((aligned(__alignof__(num_get<char>))));
fake_num_get_c num_get_c;
typedef char fake_num_put_c[sizeof(num_put<char>)]
__attribute__ ((aligned(__alignof__(num_put<char>))));
fake_num_put_c num_put_c;
typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
fake_codecvt_c codecvt_c;
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_ct;
fake_moneypunct_c moneypunct_cf;
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
fake_money_get_c money_get_c;
typedef char fake_money_put_c[sizeof(money_put<char>)]
__attribute__ ((aligned(__alignof__(money_put<char>))));
fake_money_put_c money_put_c;
typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
__attribute__ ((aligned(__alignof__(__timepunct<char>))));
fake_timepunct_c timepunct_c;
typedef char fake_time_get_c[sizeof(time_get<char>)]
__attribute__ ((aligned(__alignof__(time_get<char>))));
fake_time_get_c time_get_c;
typedef char fake_time_put_c[sizeof(time_put<char>)]
__attribute__ ((aligned(__alignof__(time_put<char>))));
fake_time_put_c time_put_c;
typedef char fake_messages_c[sizeof(messages<char>)]
__attribute__ ((aligned(__alignof__(messages<char>))));
fake_messages_c messages_c;
#ifdef _GLIBCXX_USE_WCHAR_T
extern std::ctype<wchar_t> ctype_w;
extern std::collate<wchar_t> collate_w;
extern std::numpunct<wchar_t> numpunct_w;
extern std::num_get<wchar_t> num_get_w;
extern std::num_put<wchar_t> num_put_w;
extern std::codecvt<wchar_t, char, mbstate_t> codecvt_w;
extern std::moneypunct<wchar_t, false> moneypunct_wf;
extern std::moneypunct<wchar_t, true> moneypunct_wt;
extern std::money_get<wchar_t> money_get_w;
extern std::money_put<wchar_t> money_put_w;
extern std::__timepunct<wchar_t> timepunct_w;
extern std::time_get<wchar_t> time_get_w;
extern std::time_put<wchar_t> time_put_w;
extern std::messages<wchar_t> messages_w;
typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
fake_wtype_w ctype_w;
typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
fake_wollate_w collate_w;
typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
fake_numpunct_w numpunct_w;
typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
fake_num_get_w num_get_w;
typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
fake_num_put_w num_put_w;
typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
fake_wodecvt_w codecvt_w;
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_wt;
fake_moneypunct_w moneypunct_wf;
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
fake_money_get_w money_get_w;
typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
fake_money_put_w money_put_w;
typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
fake_timepunct_w timepunct_w;
typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
fake_time_get_w time_get_w;
typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
fake_time_put_w time_put_w;
typedef char fake_messages_w[sizeof(messages<wchar_t>)]
__attribute__ ((aligned(__alignof__(messages<wchar_t>))));
fake_messages_w messages_w;
#endif
// And the caches....
extern std::locale::facet* cache_vec[_GLIBCXX_NUM_FACETS];
extern std::__numpunct_cache<char> numpunct_cache_c;
extern std::__moneypunct_cache<char, false> moneypunct_cache_cf;
extern std::__moneypunct_cache<char, true> moneypunct_cache_ct;
extern std::__timepunct_cache<char> timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
extern std::__numpunct_cache<wchar_t> numpunct_cache_w;
extern std::__moneypunct_cache<wchar_t, false> moneypunct_cache_wf;
extern std::__moneypunct_cache<wchar_t, true> moneypunct_cache_wt;
extern std::__timepunct_cache<wchar_t> timepunct_cache_w;
// Storage for "C" locale caches.
typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
fake_num_cache_c numpunct_cache_c;
typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>))));
fake_money_cache_c moneypunct_cache_ct;
fake_money_cache_c moneypunct_cache_cf;
typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
fake_time_cache_c timepunct_cache_c;
#ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
fake_num_cache_w numpunct_cache_w;
typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)]
__attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>))));
fake_money_cache_w moneypunct_cache_wt;
fake_money_cache_w moneypunct_cache_wf;
typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
fake_time_cache_w timepunct_cache_w;
#endif
// Mutex object for locale initialization.
static __glibcxx_mutex_define_initialized(locale_mutex);
} // namespace __gnu_internal
} // anonymous namespace
_GLIBCXX_BEGIN_NAMESPACE(std)
using namespace __gnu_internal;
locale::locale() throw() : _M_impl(0)
{
_S_initialize();
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
__gnu_cxx::lock sentry(locale_mutex);
_S_global->_M_add_reference();
_M_impl = _S_global;
}
......@@ -111,7 +220,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_S_initialize();
_Impl* __old;
{
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
__gnu_cxx::lock sentry(locale_mutex);
__old = _S_global;
__other._M_impl->_M_add_reference();
_S_global = __other._M_impl;
......@@ -132,7 +241,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
locale::classic()
{
_S_initialize();
return c_locale;
return reinterpret_cast<const locale&>(c_locale);
}
void
......
......@@ -35,7 +35,7 @@
#include <bits/concurrence.h>
#include <ext/mt_allocator.h>
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
#ifdef __GTHREADS
struct __freelist
......@@ -64,17 +64,16 @@ namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
_M_destroy_thread_key(void* __id)
{
// Return this thread id record to the front of thread_freelist.
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex);
__gnu_cxx::lock sentry(freelist_mutex);
size_t _M_id = reinterpret_cast<size_t>(__id);
using namespace __gnu_internal;
typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record;
_Thread_record* __tr = &freelist._M_thread_freelist_array[_M_id - 1];
__tr->_M_next = freelist._M_thread_freelist;
freelist._M_thread_freelist = __tr;
}
#endif
}
} // anonymous namespace
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
......@@ -466,10 +465,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
if (__gthread_active_p())
{
{
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex);
__gnu_cxx::lock sentry(freelist_mutex);
if (!__gnu_internal::freelist._M_thread_freelist_array
|| __gnu_internal::freelist._M_max_threads
if (!freelist._M_thread_freelist_array
|| freelist._M_max_threads
< _M_options._M_max_threads)
{
const size_t __k = sizeof(_Thread_record)
......@@ -492,22 +491,22 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_thread_freelist[__i - 1]._M_next = NULL;
_M_thread_freelist[__i - 1]._M_id = __i;
if (!__gnu_internal::freelist._M_thread_freelist_array)
if (!freelist._M_thread_freelist_array)
{
// Initialize per thread key to hold pointer to
// _M_thread_freelist.
__gthread_key_create(&__gnu_internal::freelist._M_key,
__gnu_internal::_M_destroy_thread_key);
__gnu_internal::freelist._M_thread_freelist
__gthread_key_create(&freelist._M_key,
::_M_destroy_thread_key);
freelist._M_thread_freelist
= _M_thread_freelist;
}
else
{
_Thread_record* _M_old_freelist
= __gnu_internal::freelist._M_thread_freelist;
= freelist._M_thread_freelist;
_Thread_record* _M_old_array
= __gnu_internal::freelist._M_thread_freelist_array;
__gnu_internal::freelist._M_thread_freelist
= freelist._M_thread_freelist_array;
freelist._M_thread_freelist
= &_M_thread_freelist[_M_old_freelist - _M_old_array];
while (_M_old_freelist)
{
......@@ -515,16 +514,16 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
if (_M_old_freelist->_M_next)
next_id = _M_old_freelist->_M_next - _M_old_array;
else
next_id = __gnu_internal::freelist._M_max_threads;
next_id = freelist._M_max_threads;
_M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next
= &_M_thread_freelist[next_id];
_M_old_freelist = _M_old_freelist->_M_next;
}
::operator delete(static_cast<void*>(_M_old_array));
}
__gnu_internal::freelist._M_thread_freelist_array
freelist._M_thread_freelist_array
= _M_thread_freelist;
__gnu_internal::freelist._M_max_threads
freelist._M_max_threads
= _M_options._M_max_threads;
}
}
......@@ -587,21 +586,21 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// returns it's id.
if (__gthread_active_p())
{
void* v = __gthread_getspecific(__gnu_internal::freelist._M_key);
void* v = __gthread_getspecific(freelist._M_key);
size_t _M_id = (size_t)v;
if (_M_id == 0)
{
{
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex);
if (__gnu_internal::freelist._M_thread_freelist)
__gnu_cxx::lock sentry(freelist_mutex);
if (freelist._M_thread_freelist)
{
_M_id = __gnu_internal::freelist._M_thread_freelist->_M_id;
__gnu_internal::freelist._M_thread_freelist
= __gnu_internal::freelist._M_thread_freelist->_M_next;
_M_id = freelist._M_thread_freelist->_M_id;
freelist._M_thread_freelist
= freelist._M_thread_freelist->_M_next;
}
}
__gthread_setspecific(__gnu_internal::freelist._M_key,
__gthread_setspecific(freelist._M_key,
(void*)_M_id);
}
return _M_id >= _M_options._M_max_threads ? 0 : _M_id;
......@@ -665,10 +664,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
if (__gthread_active_p())
{
{
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex);
__gnu_cxx::lock sentry(freelist_mutex);
if (!__gnu_internal::freelist._M_thread_freelist_array
|| __gnu_internal::freelist._M_max_threads
if (!freelist._M_thread_freelist_array
|| freelist._M_max_threads
< _M_options._M_max_threads)
{
const size_t __k = sizeof(_Thread_record)
......@@ -691,22 +690,21 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_thread_freelist[__i - 1]._M_next = NULL;
_M_thread_freelist[__i - 1]._M_id = __i;
if (!__gnu_internal::freelist._M_thread_freelist_array)
if (!freelist._M_thread_freelist_array)
{
// Initialize per thread key to hold pointer to
// _M_thread_freelist.
__gthread_key_create(&__gnu_internal::freelist._M_key,
__gnu_internal::_M_destroy_thread_key);
__gnu_internal::freelist._M_thread_freelist
= _M_thread_freelist;
__gthread_key_create(&freelist._M_key,
::_M_destroy_thread_key);
freelist._M_thread_freelist = _M_thread_freelist;
}
else
{
_Thread_record* _M_old_freelist
= __gnu_internal::freelist._M_thread_freelist;
= freelist._M_thread_freelist;
_Thread_record* _M_old_array
= __gnu_internal::freelist._M_thread_freelist_array;
__gnu_internal::freelist._M_thread_freelist
= freelist._M_thread_freelist_array;
freelist._M_thread_freelist
= &_M_thread_freelist[_M_old_freelist - _M_old_array];
while (_M_old_freelist)
{
......@@ -714,17 +712,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
if (_M_old_freelist->_M_next)
next_id = _M_old_freelist->_M_next - _M_old_array;
else
next_id = __gnu_internal::freelist._M_max_threads;
next_id = freelist._M_max_threads;
_M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next
= &_M_thread_freelist[next_id];
_M_old_freelist = _M_old_freelist->_M_next;
}
::operator delete(static_cast<void*>(_M_old_array));
}
__gnu_internal::freelist._M_thread_freelist_array
= _M_thread_freelist;
__gnu_internal::freelist._M_max_threads
= _M_options._M_max_threads;
freelist._M_thread_freelist_array = _M_thread_freelist;
freelist._M_max_threads = _M_options._M_max_threads;
}
}
......
......@@ -35,7 +35,7 @@
#include <cstdlib>
#include <ext/pool_allocator.h>
namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
namespace
{
static __glibcxx_mutex_define_initialized(palloc_init_mutex);
}
......@@ -52,7 +52,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
mutex_type&
__pool_alloc_base::_M_get_mutex()
{ return __gnu_internal::palloc_init_mutex; }
{ return palloc_init_mutex; }
// Allocate memory in large chunks in order to avoid fragmenting the
// heap too much. Assume that __n is properly aligned. We hold the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment