Index: include/bits/functional_hash.h =================================================================== --- include/bits/functional_hash.h (revision 128225) +++ include/bits/functional_hash.h (working copy) @@ -45,6 +45,8 @@ # error C++0x header cannot be included from TR1 header #endif +#include + #if defined(_GLIBCXX_INCLUDE_AS_CXX0X) # include #else @@ -59,20 +61,15 @@ # undef _GLIBCXX_INCLUDE_AS_CXX0X #endif -#include namespace std { + // vs. functional vs. stdexcept vs. string + struct error_code; + template<> - struct hash : public unary_function - { - size_t - operator()(error_code __e) const - { - const char* __p = reinterpret_cast(&__e); - return _Fnv_hash<>::hash(__p, sizeof(__e)); - } - }; + size_t + hash::operator()(error_code) const; } #endif // _FUNCTIONAL_HASH_H Index: include/tr1/functional_hash.h =================================================================== --- include/tr1/functional_hash.h (revision 128225) +++ include/tr1/functional_hash.h (working copy) @@ -41,6 +41,8 @@ # error TR1 header cannot be included from C++0x header #endif +#include + #if defined(_GLIBCXX_INCLUDE_AS_TR1) # include #else Index: include/tr1/functional =================================================================== --- include/tr1/functional (revision 128225) +++ include/tr1/functional (working copy) @@ -44,11 +44,10 @@ #include #include -#include #include -#include #include #include +#include #include #if defined(_GLIBCXX_INCLUDE_AS_TR1) Index: include/tr1_impl/functional_hash.h =================================================================== --- include/tr1_impl/functional_hash.h (revision 128225) +++ include/tr1_impl/functional_hash.h (working copy) @@ -36,21 +36,32 @@ { _GLIBCXX_BEGIN_NAMESPACE_TR1 - // Definition of default hash function std::tr1::hash<>. The types for - // which std::tr1::hash is defined is in clause 6.3.3. of the PDTR. + // Class template hash. + // Declaration of default hash functor std::tr1::hash. The types for + // which std::tr1::hash is well-defined is in clause 6.3.3. of the PDTR. template - struct hash; + struct hash : public std::unary_function<_Tp, size_t> + { + size_t + operator()(_Tp __val) const; + }; -#define _TR1_hashtable_define_trivial_hash(_Tp) \ - template<> \ - struct hash<_Tp> \ - : public std::unary_function<_Tp, std::size_t> \ - { \ - std::size_t \ - operator()(_Tp __val) const \ - { return static_cast(__val); } \ - } + // Partial specializations for pointer types. + template + struct hash<_Tp*> : public std::unary_function<_Tp*, size_t> + { + size_t + operator()(_Tp* __p) const + { return reinterpret_cast(__p); } + }; + // Explicit specializations for integer types. +#define _TR1_hashtable_define_trivial_hash(_Tp) \ + template<> \ + inline size_t \ + hash<_Tp>::operator()(_Tp __val) const \ + { return static_cast(__val); } + _TR1_hashtable_define_trivial_hash(bool); _TR1_hashtable_define_trivial_hash(char); _TR1_hashtable_define_trivial_hash(signed char); @@ -67,26 +78,17 @@ #undef _TR1_hashtable_define_trivial_hash - template - struct hash<_Tp*> - : public std::unary_function<_Tp*, std::size_t> - { - std::size_t - operator()(_Tp* __p) const - { return reinterpret_cast(__p); } - }; - // Fowler / Noll / Vo (FNV) Hash (type FNV-1a) - // (used by the next specializations of std::tr1::hash<>) + // (Used by the next specializations of std::tr1::hash.) // Dummy generic implementation (for sizeof(size_t) != 4, 8). - template + template struct _Fnv_hash { - static std::size_t - hash(const char* __first, std::size_t __length) + static size_t + hash(const char* __first, size_t __length) { - std::size_t __result = 0; + size_t __result = 0; for (; __length > 0; --__length) __result = (__result * 131) + *__first++; return __result; @@ -96,14 +98,14 @@ template<> struct _Fnv_hash<4> { - static std::size_t - hash(const char* __first, std::size_t __length) + static size_t + hash(const char* __first, size_t __length) { - std::size_t __result = static_cast(2166136261UL); + size_t __result = static_cast(2166136261UL); for (; __length > 0; --__length) { - __result ^= static_cast(*__first++); - __result *= static_cast(16777619UL); + __result ^= static_cast(*__first++); + __result *= static_cast(16777619UL); } return __result; } @@ -112,112 +114,103 @@ template<> struct _Fnv_hash<8> { - static std::size_t - hash(const char* __first, std::size_t __length) + static size_t + hash(const char* __first, size_t __length) { - std::size_t __result = - static_cast(14695981039346656037ULL); + size_t __result = + static_cast(14695981039346656037ULL); for (; __length > 0; --__length) { - __result ^= static_cast(*__first++); - __result *= static_cast(1099511628211ULL); + __result ^= static_cast(*__first++); + __result *= static_cast(1099511628211ULL); } return __result; } }; - // XXX String and floating point hashes probably shouldn't be inline - // member functions, since are nontrivial. Once we have the framework - // for TR1 .cc files, these should go in one. + // Explicit specializations for floating point types. template<> - struct hash - : public std::unary_function - { - std::size_t - operator()(const std::string& __s) const - { return _Fnv_hash<>::hash(__s.data(), __s.length()); } - }; - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - struct hash - : public std::unary_function + inline size_t + hash::operator()(float __val) const { - std::size_t - operator()(const std::wstring& __s) const - { - return _Fnv_hash<>::hash(reinterpret_cast(__s.data()), - __s.length() * sizeof(wchar_t)); - } + size_t __result = 0; + + // 0 and -0 both hash to zero. + if (__val != 0.0f) + __result = _Fnv_hash<>::hash(reinterpret_cast(&__val), + sizeof(__val)); + return __result; }; -#endif template<> - struct hash - : public std::unary_function + inline size_t + hash::operator()(double __val) const { - std::size_t - operator()(float __fval) const - { - std::size_t __result = 0; + size_t __result = 0; // 0 and -0 both hash to zero. - if (__fval != 0.0f) - __result = _Fnv_hash<>::hash(reinterpret_cast(&__fval), - sizeof(__fval)); + if (__val != 0.0) + __result = _Fnv_hash<>::hash(reinterpret_cast(&__val), + sizeof(__val)); return __result; - } }; + // For long double, careful with random padding bits (e.g., on x86, + // 10 bytes -> 12 bytes) and resort to frexp. template<> - struct hash - : public std::unary_function + inline size_t + hash::operator()(long double __val) const { - std::size_t - operator()(double __dval) const - { - std::size_t __result = 0; + size_t __result = 0; - // 0 and -0 both hash to zero. - if (__dval != 0.0) - __result = _Fnv_hash<>::hash(reinterpret_cast(&__dval), - sizeof(__dval)); - return __result; - } + int __exponent; + __val = std::frexp(__val, &__exponent); + __val = __val < 0.0l ? -(__val + 0.5l) : __val; + + const long double __mult = + __gnu_cxx::__numeric_traits::__max + 1.0l; + __val *= __mult; + + // Try to use all the bits of the mantissa (really necessary only + // on 32-bit targets, at least for 80-bit floating point formats). + const size_t __hibits = (size_t)__val; + __val = (__val - (long double)__hibits) * __mult; + + const size_t __coeff = + __gnu_cxx::__numeric_traits::__max / __LDBL_MAX_EXP__; + + __result = __hibits + (size_t)__val + __coeff * __exponent; + + return __result; }; - // For long double, careful with random padding bits (e.g., on x86, - // 10 bytes -> 12 bytes) and resort to frexp. template<> - struct hash - : public std::unary_function - { - std::size_t - operator()(long double __ldval) const - { - std::size_t __result = 0; + size_t + hash::operator()(string) const; - int __exponent; - __ldval = std::frexp(__ldval, &__exponent); - __ldval = __ldval < 0.0l ? -(__ldval + 0.5l) : __ldval; + template<> + size_t + hash::operator()(const string&) const; - const long double __mult = - __gnu_cxx::__numeric_traits::__max + 1.0l; - __ldval *= __mult; +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + size_t + hash::operator()(wstring) const; - // Try to use all the bits of the mantissa (really necessary only - // on 32-bit targets, at least for 80-bit floating point formats). - const std::size_t __hibits = (std::size_t)__ldval; - __ldval = (__ldval - (long double)__hibits) * __mult; + template<> + size_t + hash::operator()(const wstring&) const; +#endif - const std::size_t __coeff = - __gnu_cxx::__numeric_traits::__max / __LDBL_MAX_EXP__; +#if 0 + template<> + inline size_t + hash::operator()(u16string) const; - __result = __hibits + (std::size_t)__ldval + __coeff * __exponent; + template<> + inline size_t + hash::operator()(u32string) const; +#endif - return __result; - } - }; - _GLIBCXX_END_NAMESPACE_TR1 } Index: src/functional_hash.cc =================================================================== --- src/functional_hash.cc (revision 0) +++ src/functional_hash.cc (revision 0) @@ -0,0 +1,93 @@ +// functional_hash.h header -*- C++ -*- + +// Copyright (C) 2007 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 +#include + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 +# define _GLIBCXX_END_NAMESPACE_TR1 +# define _GLIBCXX_TR1 std:: +#else +#include +# define _GLIBCXX_INCLUDE_AS_TR1 +# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 { +# define _GLIBCXX_END_NAMESPACE_TR1 } +# define _GLIBCXX_TR1 tr1:: +#endif + +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_TR1 + + template<> + size_t + hash::operator()(string __s) const + { return _Fnv_hash<>::hash(__s.data(), __s.length()); } + + template<> + size_t + hash::operator()(const string& __s) const + { return _Fnv_hash<>::hash(__s.data(), __s.length()); } + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + size_t + hash::operator()(wstring __s) const + { + const char* __p = reinterpret_cast(__s.data()); + return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t)); + } + + template<> + size_t + hash::operator()(const wstring& __s) const + { + const char* __p = reinterpret_cast(__s.data()); + return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t)); + } +#endif + +_GLIBCXX_END_NAMESPACE_TR1 +} + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include +namespace std +{ + template<> + size_t + hash::operator()(error_code __e) const + { + const char* __p = reinterpret_cast(&__e); + return _Fnv_hash<>::hash(__p, sizeof(__e)); + } +} +#endif Index: config/abi/pre/gnu.ver =================================================================== --- config/abi/pre/gnu.ver (revision 128225) +++ config/abi/pre/gnu.ver (working copy) @@ -60,7 +60,8 @@ # std::c[i-z]*; std::c[i-s]*; std::c[u-z]*; - std::[d-h]*; + std::[d-g]*; + std::h[^a]*; std::i[a-n]*; std::ios_base::[A-Ha-z]*; std::ios_base::_M_grow_words*; @@ -107,7 +108,10 @@ # std::string std::strstream*; std::strstreambuf*; - std::[A-Zt-z]*; + std::t[a-q]*; + std::tr1::h[^a]*; + std::t[s-z]*; + std::[A-Zu-z]*; std::_List_node_base::hook*; std::_List_node_base::swap*; std::_List_node_base::unhook*; @@ -753,7 +757,26 @@ _ZTISt12system_error; _ZTVSt12system_error; _ZNSt12system_errorD*Ev; + _ZNSt12system_errorC*; + # for parallel mode + _ZNSt9__cxx199815_List_node_base4hook*; + _ZNSt9__cxx199815_List_node_base4swap*; + _ZNSt9__cxx199815_List_node_base6unhookEv; + _ZNSt9__cxx199815_List_node_base7reverseEv; + _ZNSt9__cxx199815_List_node_base8transfer*; + + _ZNKSt3tr14hashIRKSbIwSt11char_traitsIwESaIwEEEclES6_; + _ZNKSt3tr14hashIRKSsEclES2_; + _ZNKSt3tr14hashISbIwSt11char_traitsIwESaIwEEEclES4_; + _ZNKSt3tr14hashISsEclESs; + + _ZNKSt4hashIRKSbIwSt11char_traitsIwESaIwEEEclES5_; + _ZNKSt4hashIRKSsEclES1_; + _ZNKSt4hashISbIwSt11char_traitsIwESaIwEEEclES3_; + _ZNKSt4hashISsEclESs; + _ZNKSt4hashISt10error_codeEclES0_; + } GLIBCXX_3.4.9; # Symbols in the support library (libsupc++) have their own tag. Index: config/abi/pre/gnu-versioned-namespace.ver =================================================================== --- config/abi/pre/gnu-versioned-namespace.ver (revision 128225) +++ config/abi/pre/gnu-versioned-namespace.ver (working copy) @@ -66,7 +66,8 @@ _ZNSt2_614__convert_to_v*; # std::__copy_streambufs - _ZNSt2_617__copy_streambufsI[cw]NS_11char_traitsI[cw]EEEEiPNS_15basic_streambufIT_T0_EES7_; + _ZNSt2_617__copy_streambufsI*; + _ZNSt2_621__copy_streambufs_eofI*; # __gnu_cxx::__atomic_add # __gnu_cxx::__exchange_and_add @@ -87,6 +88,40 @@ _ZN9__gnu_cxx2_69free_list6_M_getE[jm]; _ZN9__gnu_cxx2_69free_list8_M_clearEv; + # debug mode + _ZN10__gnu_norm15_List_node_base4hook*; + _ZN10__gnu_norm15_List_node_base4swap*; + _ZN10__gnu_norm15_List_node_base6unhookEv; + _ZN10__gnu_norm15_List_node_base7reverseEv; + _ZN10__gnu_norm15_List_node_base8transfer*; + + _ZNSt6__norm15_List_node_base4hook*; + _ZNSt6__norm15_List_node_base4swap*; + _ZNSt6__norm15_List_node_base6unhookEv; + _ZNSt6__norm15_List_node_base7reverseEv; + _ZNSt6__norm15_List_node_base8transfer*; + + _ZN11__gnu_debug19_Safe_sequence_base12_M_get_mutexEv; + _ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv; + _ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv; + _ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv; + _ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_; + + _ZN11__gnu_debug19_Safe_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb; + _ZN11__gnu_debug19_Safe_iterator_base16_M_attach_singleEPNS_19_Safe_sequence_baseEb; + _ZN11__gnu_debug19_Safe_iterator_base9_M_detachEv; + _ZN11__gnu_debug19_Safe_iterator_base16_M_detach_singleEv; + _ZN11__gnu_debug19_Safe_iterator_base12_M_get_mutexEv; + _ZNK11__gnu_debug19_Safe_iterator_base11_M_singularEv; + _ZNK11__gnu_debug19_Safe_iterator_base14_M_can_compareERKS0_; + + _ZNK11__gnu_debug16_Error_formatter10_M_message*; + _ZNK11__gnu_debug16_Error_formatter10_Parameter*; + _ZNK11__gnu_debug16_Error_formatter13_M_print_word*; + _ZNK11__gnu_debug16_Error_formatter15_M_print_string*; + _ZNK11__gnu_debug16_Error_formatter8_M_error*; + _ZNK11__gnu_debug16_Error_formatter17_M_get_max_lengthEv; + local: *; }; @@ -164,7 +199,7 @@ _ZTVN10__cxxabiv120__si_class_type_infoE; _ZTVN10__cxxabiv121__vmi_class_type_infoE; - # typeinfo structure (and some names) + # typeinfo structure _ZTI[a-z]; _ZTIP[a-z]; _ZTIPK[a-z]; @@ -178,6 +213,8 @@ _ZTIN10__cxxabiv119__pointer_type_infoE; _ZTIN10__cxxabiv120__si_class_type_infoE; _ZTIN10__cxxabiv121__vmi_class_type_infoE; + _ZTIN10__cxxabiv115__forced_unwindE; + _ZTIN10__cxxabiv119__foreign_exceptionE; # typeinfo name _ZTS[a-z]; @@ -200,11 +237,3 @@ local: *; }; - -CXXABI_1.7.1 { - - # typeinfo structures - _ZTIN10__cxxabiv115__forced_unwindE; - _ZTIN10__cxxabiv119__foreign_exceptionE; - -} CXXABI_1.7;