diff options
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/Makefile.am | 6 | ||||
-rw-r--r-- | libstdc++-v3/src/Makefile.in | 34 | ||||
-rw-r--r-- | libstdc++-v3/src/compatibility-c++0x.cc (renamed from libstdc++-v3/src/hash_c++0x.cc) | 31 | ||||
-rw-r--r-- | libstdc++-v3/src/hash.cc | 6 |
4 files changed, 50 insertions, 27 deletions
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 9513bd5..4306dd5 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -140,12 +140,12 @@ sources = \ mt_allocator.cc \ codecvt.cc \ compatibility.cc \ + compatibility-c++0x.cc \ complex_io.cc \ ctype.cc \ debug.cc \ functexcept.cc \ hash_tr1.cc \ - hash_c++0x.cc \ globals_io.cc \ hashtable_tr1.cc \ hashtable_c++0x.cc \ @@ -260,9 +260,9 @@ condition_variable.lo: condition_variable.cc condition_variable.o: condition_variable.cc $(CXXCOMPILE) -std=gnu++0x -c $< -hash_c++0x.lo: hash_c++0x.cc +compatibility-c++0x.lo: compatibility-c++0x.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< -hash_c++0x.o: hash_c++0x.cc +compatibility-c++0x.o: compatibility-c++0x.cc $(CXXCOMPILE) -std=gnu++0x -c $< hashtable_c++0x.lo: hashtable_c++0x.cc diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 9c03ac4..8cc950f 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -87,8 +87,8 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES) am__DEPENDENCIES_1 = am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \ pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \ - complex_io.cc ctype.cc debug.cc functexcept.cc hash_tr1.cc \ - hash_c++0x.cc globals_io.cc hashtable_tr1.cc \ + compatibility-c++0x.cc complex_io.cc ctype.cc debug.cc \ + functexcept.cc hash_tr1.cc globals_io.cc hashtable_tr1.cc \ hashtable_c++0x.cc ios.cc ios_failure.cc ios_init.cc \ ios_locale.cc limits.cc limits_c++0x.cc list.cc debug_list.cc \ locale.cc locale_init.cc locale_facets.cc localename.cc \ @@ -113,18 +113,18 @@ am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \ am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \ $(am__objects_3) am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \ - mt_allocator.lo codecvt.lo compatibility.lo complex_io.lo \ - ctype.lo debug.lo functexcept.lo hash_tr1.lo hash_c++0x.lo \ - globals_io.lo hashtable_tr1.lo hashtable_c++0x.lo ios.lo \ - ios_failure.lo ios_init.lo ios_locale.lo limits.lo \ - limits_c++0x.lo list.lo debug_list.lo locale.lo locale_init.lo \ - locale_facets.lo localename.lo math_stubs_float.lo \ - math_stubs_long_double.lo stdexcept.lo strstream.lo \ - system_error.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 \ + mt_allocator.lo codecvt.lo compatibility.lo \ + compatibility-c++0x.lo complex_io.lo ctype.lo debug.lo \ + functexcept.lo hash_tr1.lo globals_io.lo hashtable_tr1.lo \ + hashtable_c++0x.lo ios.lo ios_failure.lo ios_init.lo \ + ios_locale.lo limits.lo limits_c++0x.lo list.lo debug_list.lo \ + locale.lo locale_init.lo locale_facets.lo localename.lo \ + math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \ + strstream.lo system_error.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 mutex.lo condition_variable.lo chrono.lo \ thread.lo future.lo $(am__objects_1) $(am__objects_4) am_libstdc___la_OBJECTS = $(am__objects_5) @@ -382,12 +382,12 @@ sources = \ mt_allocator.cc \ codecvt.cc \ compatibility.cc \ + compatibility-c++0x.cc \ complex_io.cc \ ctype.cc \ debug.cc \ functexcept.cc \ hash_tr1.cc \ - hash_c++0x.cc \ globals_io.cc \ hashtable_tr1.cc \ hashtable_c++0x.cc \ @@ -891,9 +891,9 @@ condition_variable.lo: condition_variable.cc condition_variable.o: condition_variable.cc $(CXXCOMPILE) -std=gnu++0x -c $< -hash_c++0x.lo: hash_c++0x.cc +compatibility-c++0x.lo: compatibility-c++0x.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< -hash_c++0x.o: hash_c++0x.cc +compatibility-c++0x.o: compatibility-c++0x.cc $(CXXCOMPILE) -std=gnu++0x -c $< hashtable_c++0x.lo: hashtable_c++0x.cc diff --git a/libstdc++-v3/src/hash_c++0x.cc b/libstdc++-v3/src/compatibility-c++0x.cc index 5bdbf0c..0e92135 100644 --- a/libstdc++-v3/src/hash_c++0x.cc +++ b/libstdc++-v3/src/compatibility-c++0x.cc @@ -1,6 +1,6 @@ -// std::hash definitions -*- C++ -*- +// Compatibility symbols for previous versions, C++0x bits -*- C++ -*- -// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2009 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 @@ -25,15 +25,38 @@ #include <cstddef> #include <string> #include <cmath> -#include <functional> #include <system_error> #ifndef __GXX_EXPERIMENTAL_CXX0X__ -# error "hash_c++0x.cc must be compiled with -std=gnu++0x" +# error "compatibility-c++0x.cc must be compiled with -std=gnu++0x" #endif namespace std { + // We need these due to the symbols exported since GLIBCXX_3.4.10. + // See libstdc++/41662 for details. + + template<typename _Tp> + struct hash : public std::unary_function<_Tp, size_t> + { + size_t + operator()(_Tp __val) const; + }; + + /// Dummy generic implementation (for sizeof(size_t) != 4, 8). + template<size_t = sizeof(size_t)> + struct _Fnv_hash + { + static size_t + hash(const char* __first, size_t __length) + { + size_t __result = 0; + for (; __length > 0; --__length) + __result = (__result * 131) + *__first++; + return __result; + } + }; + #include "hash.cc" template<> diff --git a/libstdc++-v3/src/hash.cc b/libstdc++-v3/src/hash.cc index c776ed5..cc23858 100644 --- a/libstdc++-v3/src/hash.cc +++ b/libstdc++-v3/src/hash.cc @@ -26,7 +26,7 @@ // 10 bytes -> 12 bytes) and resort to frexp. template<> size_t - hash<long double>::operator()(long double __val) const throw () + hash<long double>::operator()(long double __val) const { size_t __result = 0; @@ -59,7 +59,7 @@ template<> size_t - hash<const string&>::operator()(const string& __s) const throw () + hash<const string&>::operator()(const string& __s) const { return _Fnv_hash<>::hash(__s.data(), __s.length()); } #ifdef _GLIBCXX_USE_WCHAR_T @@ -73,7 +73,7 @@ template<> size_t - hash<const wstring&>::operator()(const wstring& __s) const throw () + hash<const wstring&>::operator()(const wstring& __s) const { const char* __p = reinterpret_cast<const char*>(__s.data()); return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t)); |