import GCC 4.1 branch from today. it includes these bugs fixed since

our last 4.1 branch import, plus a few other changes:
	c/27718 26242 c++/27451 c/26818 tree-optimization/26622
	target/27758 middle-end/27743 middle-end/27620
	tree-optimization/27549 tree-optimization/27283
	target/26600 c++/26757 driver/26885 tree-optimization/27603
	rtl-optimization/14261 rtl-optimization/22563 middle-end/26729
	rtl-optimization/27335 target/27421 middle-end/27384
	middle-end/27488 target/27158 bootstrap/26872 target/26545
	tree-optimization/27136 tree-optimization/27409 middle-end/27260
	tree-optimization/27151 target/26481 target/26765
	target/26481 tree-optimization/27285 optimization/25985
	tree-optimization/27364 c/25309 target/27387 target/27374
	middle-end/26565 target/26826 tree-optimization/27236
	middle-end/26869 tree-optimization/27218 rtl-optimization/26685
	tree-optimization/26865 target/26961 target/21283 c/26774 c/25875
	mudflap/26789
This commit is contained in:
mrg 2006-06-03 05:43:09 +00:00
parent 6346714276
commit ac4333ea1b
10 changed files with 882 additions and 496 deletions

View File

@ -1,3 +1,84 @@
2006-05-26 Paolo Carlini <pcarlini@suse.de>
* include/tr1/hashtable: Minor cosmetic changes.
2006-05-26 Paolo Carlini <pcarlini@suse.de>
* include/tr1/hashtable (hashtable<>::m_find): Remove; update callers.
* include/tr1/hashtable (map_base<>::operator[]): Move out of line.
* include/tr1/hashtable (hashtable<>::m_insert(const value_type&,
std::tr1::false_type)): Avoid memory leak risk for new_node.
2006-05-26 Paolo Carlini <pcarlini@suse.de>
* include/tr1/hashtable (hashtable<>::m_find, m_insert_bucket): Add.
(hashtable<>::find, m_insert(const value_type&, std::tr1::true_type),
map_base<>::operator[]): Use the above.
* testsuite/performance/23_containers/insert/unordered_map_array.cc:
New.
* include/tr1/hashtable (hashtable<>::find_node,
insert(const value_type&, ...), erase_node): Rename to m_*, adjust
callers.
* include/tr1/hashtable: Minor cosmetic changes.
2006-05-24 Release Manager
* GCC 4.1.1 released.
2006-05-14 Peter Doerfler <gcc@pdoerfler.com>
* include/tr1/hashtable (identity<>::operator(),
extract1st<>::operator()): Return by const ref.
2006-05-11 Paolo Carlini <pcarlini@suse.de>
Peter Doerfler <gcc@pdoerfler.com>
* include/tr1/hashtable (hashtable_iterator<>::hashtable_iterator(),
hashtable_const_iterator<>::hashtable_const_iterator(),
node_iterator<>::node_iterator(),
node_const_iterator<>::node_const_iterator()): Add.
(node_iterator<>::node_iterator(hash_node<>*),
node_const_iterator<>::node_const_iterator(hash_node<>*)): Tweak,
remove default.
* testsuite/tr1/6_containers/unordered/hashtable/
iterators_default_constructor.c: New.
2006-05-09 Paolo Carlini <pcarlini@suse.de>
* include/tr1/type_traits (integral_constant<>::value): Define.
* testsuite/tr1/4_metaprogramming/helper_classes/static_definition.cc:
New.
2006-05-03 Paolo Carlini <pcarlini@suse.de>
* acinclude.m4 (GLIBCXX_ENABLE_WCHAR_T): Always check the
presence of wctype.h, for use in GLIBCXX_ENABLE_C99.
* configure: Regenerate.
2006-05-03 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/6702 (again)
* acinclude.m4 (GLIBCXX_ENABLE_C99): Don't check non-C99
wchar_t functions...
(GLIBCXX_ENABLE_WCHAR_T): ... do that here.
* configure.ac: Adjust order of checks.
* configure: Regenerate.
2006-04-26 Shantonu Sen <ssen@opendarwin.org>
PR libstdc++/26513
* scripts/make_exports.pl: Use $ENV{NM_FOR_TARGET}, if present.
2006-04-21 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/26424
* include/tr1/hashtable (X<>::primes): Extend for 64-bit machines.
(X<>::n_primes): Adjust.
(prime_rehash_policy::next_bkt, bkt_for_elements, need_rehash): Adjust.
2006-04-18 Paolo Carlini <pcarlini@suse.de>
* docs/html/faq/index.html ([5.5]): Adjust to mention function

View File

@ -780,18 +780,6 @@ dnl
AC_DEFUN([GLIBCXX_ENABLE_C99], [
GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
# Test wchar.h for mbstate_t, which is needed for char_traits and fpos
# even if C99 support is turned off.
AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
AC_MSG_CHECKING([for mbstate_t])
AC_TRY_COMPILE([#include <wchar.h>],
[mbstate_t teststate;],
have_mbstate_t=yes, have_mbstate_t=no)
AC_MSG_RESULT($have_mbstate_t)
if test x"$have_mbstate_t" = xyes; then
AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
fi
if test x"$enable_c99" = x"yes"; then
AC_LANG_SAVE
@ -916,74 +904,17 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
])
AC_MSG_RESULT($ac_c99_stdlib)
# Check for the existence in <wchar.h> of wcstoull, WEOF, etc.
AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
# Check for the existence in <wchar.h> of wcstold, etc.
ac_c99_wchar=no;
if test x"$ac_has_wchar_h" = xyes &&
test x"$ac_has_wctype_h" = xyes; then
AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
AC_TRY_COMPILE([#include <wchar.h>
#include <stddef.h>
wint_t i;
long l = WEOF;
long j = WCHAR_MIN;
long k = WCHAR_MAX;
namespace test
{
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
using ::wcrtomb;
using ::wcscat;
using ::wcschr;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsrtombs;
using ::wcsspn;
using ::wcsstr;
using ::wcstod;
using ::wcstok;
using ::wcstol;
using ::wcstold;
using ::wcstoll;
using ::wcstoul;
using ::wcstoull;
using ::wcsxfrm;
using ::wctob;
using ::wmemchr;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
}
],[],[ac_c99_wchar=yes], [ac_c99_wchar=no])
@ -1014,7 +945,6 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
[AC_DEFINE(HAVE_ISWBLANK,1,
[Defined if iswblank exists.])],[])
AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
AC_MSG_RESULT($ac_c99_wchar)
fi
@ -1543,14 +1473,107 @@ dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined
dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'.
dnl
dnl Necessary support (probed along with C99 support) must also be present.
dnl Necessary support must also be present.
dnl
AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t'])
if test x"$ac_c99_wchar" = x"yes" && test x"$enable_wchar_t" = x"yes"; then
# Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
AC_MSG_CHECKING([for mbstate_t])
AC_TRY_COMPILE([#include <wchar.h>],
[mbstate_t teststate;],
have_mbstate_t=yes, have_mbstate_t=no)
AC_MSG_RESULT($have_mbstate_t)
if test x"$have_mbstate_t" = xyes; then
AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
fi
# Test it always, for use in GLIBCXX_ENABLE_C99, together with
# ac_has_wchar_h.
AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
if test x"$enable_wchar_t" = x"yes"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
if test x"$ac_has_wchar_h" = xyes &&
test x"$ac_has_wctype_h" = xyes; then
AC_TRY_COMPILE([#include <wchar.h>
#include <stddef.h>
wint_t i;
long l = WEOF;
long j = WCHAR_MIN;
long k = WCHAR_MAX;
namespace test
{
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
using ::wcrtomb;
using ::wcscat;
using ::wcschr;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsrtombs;
using ::wcsspn;
using ::wcsstr;
using ::wcstod;
using ::wcstok;
using ::wcstol;
using ::wcstoul;
using ::wcsxfrm;
using ::wctob;
using ::wmemchr;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
}
],[],[], [enable_wchar_t=no])
else
enable_wchar_t=no
fi
AC_LANG_RESTORE
fi
if test x"$enable_wchar_t" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1,
[Define if code specialized for wchar_t should be used.])
fi
AC_MSG_CHECKING([for enabled wchar_t specializations])
AC_MSG_RESULT([$enable_wchar_t])
])

View File

@ -869,12 +869,12 @@ Optional Features:
[default=auto]
--enable-cheaders=KIND construct "C" headers for g++
[default=$c_model]
--enable-c99 turns on ISO/IEC 9899:1999 support
[default=yes]
--enable-long-long enable template specializations for 'long long'
[default=yes]
--enable-wchar_t enable template specializations for 'wchar_t'
[default=yes]
--enable-c99 turns on ISO/IEC 9899:1999 support
[default=yes]
--enable-concept-checks use Boost-derived template checks [default=no]
--enable-libstdcxx-debug-flags=FLAGS
pass compiler FLAGS when building debug library
@ -6418,26 +6418,52 @@ echo "$as_me: \"C\" header strategy set to $enable_cheaders" >&6;}
# Check whether --enable-c99 or --disable-c99 was given.
if test "${enable_c99+set}" = set; then
enableval="$enable_c99"
# Check whether --enable-long-long or --disable-long-long was given.
if test "${enable_long_long+set}" = set; then
enableval="$enable_long_long"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable c99 must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable c99 must be yes or no" >&2;}
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable long-long must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable long-long must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable_c99=yes
enable_long_long=yes
fi;
if test $enable_long_long = yes; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_LONG_LONG 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for enabled long long specializations" >&5
echo $ECHO_N "checking for enabled long long specializations... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $enable_long_long" >&5
echo "${ECHO_T}$enable_long_long" >&6
# Check whether --enable-wchar_t or --disable-wchar_t was given.
if test "${enable_wchar_t+set}" = set; then
enableval="$enable_wchar_t"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable wchar_t must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable wchar_t must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable_wchar_t=yes
fi;
# Test wchar.h for mbstate_t, which is needed for char_traits and fpos
# even if C99 support is turned off.
# Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
for ac_header in wchar.h
do
@ -6647,6 +6673,323 @@ _ACEOF
fi
# Test it always, for use in GLIBCXX_ENABLE_C99, together with
# ac_has_wchar_h.
for ac_header in wctype.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------------------- ##
## Report this to the package-unused lists. ##
## ----------------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
ac_has_wctype_h=yes
else
ac_has_wctype_h=no
fi
done
if test x"$enable_wchar_t" = x"yes"; then
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test x"$ac_has_wchar_h" = xyes &&
test x"$ac_has_wctype_h" = xyes; then
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <wchar.h>
#include <stddef.h>
wint_t i;
long l = WEOF;
long j = WCHAR_MIN;
long k = WCHAR_MAX;
namespace test
{
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
using ::wcrtomb;
using ::wcscat;
using ::wcschr;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsrtombs;
using ::wcsspn;
using ::wcsstr;
using ::wcstod;
using ::wcstok;
using ::wcstol;
using ::wcstoul;
using ::wcsxfrm;
using ::wctob;
using ::wmemchr;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
}
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
enable_wchar_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
enable_wchar_t=no
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
if test x"$enable_wchar_t" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_WCHAR_T 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for enabled wchar_t specializations" >&5
echo $ECHO_N "checking for enabled wchar_t specializations... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $enable_wchar_t" >&5
echo "${ECHO_T}$enable_wchar_t" >&6
# Check whether --enable-c99 or --disable-c99 was given.
if test "${enable_c99+set}" = set; then
enableval="$enable_c99"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable c99 must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable c99 must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable_c99=yes
fi;
if test x"$enable_c99" = x"yes"; then
@ -7125,162 +7468,12 @@ fi
echo "$as_me:$LINENO: result: $ac_c99_stdlib" >&5
echo "${ECHO_T}$ac_c99_stdlib" >&6
# Check for the existence in <wchar.h> of wcstoull, WEOF, etc.
for ac_header in wctype.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------------------- ##
## Report this to the package-unused lists. ##
## ----------------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
ac_has_wctype_h=yes
else
ac_has_wctype_h=no
fi
done
# Check for the existence in <wchar.h> of wcstold, etc.
ac_c99_wchar=no;
if test x"$ac_has_wchar_h" = xyes &&
test x"$ac_has_wctype_h" = xyes; then
echo "$as_me:$LINENO: checking for ISO C99 support in <wchar.h>" >&5
echo $ECHO_N "checking for ISO C99 support in <wchar.h>... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@ -7288,68 +7481,11 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <wchar.h>
#include <stddef.h>
wint_t i;
long l = WEOF;
long j = WCHAR_MIN;
long k = WCHAR_MAX;
namespace test
{
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
using ::wcrtomb;
using ::wcscat;
using ::wcschr;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsrtombs;
using ::wcsspn;
using ::wcsstr;
using ::wcstod;
using ::wcstok;
using ::wcstol;
using ::wcstold;
using ::wcstoll;
using ::wcstoul;
using ::wcstoull;
using ::wcsxfrm;
using ::wctob;
using ::wmemchr;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
}
int
@ -7644,8 +7780,6 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: checking for ISO C99 support in <wchar.h>" >&5
echo $ECHO_N "checking for ISO C99 support in <wchar.h>... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $ac_c99_wchar" >&5
echo "${ECHO_T}$ac_c99_wchar" >&6
fi
@ -7679,62 +7813,6 @@ echo $ECHO_N "checking for fully enabled ISO C99 support... $ECHO_C" >&6
echo "${ECHO_T}$enable_c99" >&6
# Check whether --enable-long-long or --disable-long-long was given.
if test "${enable_long_long+set}" = set; then
enableval="$enable_long_long"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable long-long must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable long-long must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable_long_long=yes
fi;
if test $enable_long_long = yes; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_LONG_LONG 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for enabled long long specializations" >&5
echo $ECHO_N "checking for enabled long long specializations... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $enable_long_long" >&5
echo "${ECHO_T}$enable_long_long" >&6
# Check whether --enable-wchar_t or --disable-wchar_t was given.
if test "${enable_wchar_t+set}" = set; then
enableval="$enable_wchar_t"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable wchar_t must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable wchar_t must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable_wchar_t=yes
fi;
if test x"$ac_c99_wchar" = x"yes" && test x"$enable_wchar_t" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_WCHAR_T 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for enabled wchar_t specializations" >&5
echo $ECHO_N "checking for enabled wchar_t specializations... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $enable_wchar_t" >&5
echo "${ECHO_T}$enable_wchar_t" >&6
# Check whether --enable-concept-checks or --disable-concept-checks was given.
if test "${enable_concept_checks+set}" = set; then
enableval="$enable_concept_checks"

View File

@ -101,9 +101,9 @@ GLIBCXX_ENABLE_CSTDIO
GLIBCXX_ENABLE_CLOCALE
GLIBCXX_ENABLE_ALLOCATOR
GLIBCXX_ENABLE_CHEADERS($c_model) dnl c_model from configure.host
GLIBCXX_ENABLE_C99([yes])
GLIBCXX_ENABLE_LONG_LONG([yes])
GLIBCXX_ENABLE_WCHAR_T([yes])
GLIBCXX_ENABLE_C99([yes])
GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"])
GLIBCXX_ENABLE_DEBUG([no])

View File

@ -169,8 +169,11 @@ namespace Internal
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
node_iterator()
: node_iterator_base<Value, cache>(0) { }
explicit
node_iterator(hash_node<Value, cache>* p = 0)
node_iterator(hash_node<Value, cache>* p)
: node_iterator_base<Value, cache>(p) { }
reference
@ -207,8 +210,11 @@ namespace Internal
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
node_const_iterator()
: node_iterator_base<Value, cache>(0) { }
explicit
node_const_iterator(hash_node<Value, cache>* p = 0)
node_const_iterator(hash_node<Value, cache>* p)
: node_iterator_base<Value, cache>(p) { }
node_const_iterator(const node_iterator<Value, constant_iterators,
@ -244,8 +250,7 @@ namespace Internal
{
hashtable_iterator_base(hash_node<Value, cache>* node,
hash_node<Value, cache>** bucket)
: m_cur_node(node), m_cur_bucket(bucket)
{ }
: m_cur_node(node), m_cur_bucket(bucket) { }
void
incr()
@ -301,6 +306,9 @@ namespace Internal
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
hashtable_iterator()
: hashtable_iterator_base<Value, cache>(0, 0) { }
hashtable_iterator(hash_node<Value, cache>* p,
hash_node<Value, cache>** b)
: hashtable_iterator_base<Value, cache>(p, b) { }
@ -308,7 +316,7 @@ namespace Internal
explicit
hashtable_iterator(hash_node<Value, cache>** b)
: hashtable_iterator_base<Value, cache>(*b, b) { }
reference
operator*() const
{ return this->m_cur_node->m_v; }
@ -343,6 +351,9 @@ namespace Internal
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
hashtable_const_iterator()
: hashtable_iterator_base<Value, cache>(0, 0) { }
hashtable_const_iterator(hash_node<Value, cache>* p,
hash_node<Value, cache>** b)
: hashtable_iterator_base<Value, cache>(p, b) { }
@ -350,7 +361,7 @@ namespace Internal
explicit
hashtable_const_iterator(hash_node<Value, cache>** b)
: hashtable_iterator_base<Value, cache>(*b, b) { }
hashtable_const_iterator(const hashtable_iterator<Value,
constant_iterators, cache>& x)
: hashtable_iterator_base<Value, cache>(x.m_cur_node, x.m_cur_bucket) { }
@ -390,7 +401,7 @@ namespace Internal
template<typename T>
struct identity
{
T
const T&
operator()(const T& t) const
{ return t; }
};
@ -398,7 +409,7 @@ namespace Internal
template<typename Pair>
struct extract1st
{
typename Pair::first_type
const typename Pair::first_type&
operator()(const Pair& p) const
{ return p.first; }
};
@ -412,7 +423,7 @@ namespace Internal
typedef std::size_t result_type;
result_type
operator() (first_argument_type r, second_argument_type N) const
operator()(first_argument_type r, second_argument_type N) const
{ return r % N; }
};
@ -467,18 +478,18 @@ namespace Internal
{ return x < y; }
};
template<int dummy>
template<int ulongsize = sizeof(unsigned long)>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
static const int n_primes = ulongsize != 8 ? 256 : 256 + 48;
static const unsigned long primes[256 + 48 + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int ulongsize>
const int X<ulongsize>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + 1] =
template<int ulongsize>
const unsigned long X<ulongsize>::primes[256 + 48 + 1] =
{
2ul, 3ul, 5ul, 7ul, 11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul,
37ul, 41ul, 43ul, 47ul, 53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul,
@ -521,7 +532,38 @@ namespace Internal
2364114217ul, 2557710269ul, 2767159799ul, 2993761039ul,
3238918481ul, 3504151727ul, 3791104843ul, 4101556399ul,
4294967291ul,
4294967291ul // sentinel so we don't have to test result of lower_bound
// Sentinel, so we don't have to test the result of lower_bound,
// or, on 64-bit machines, rest of the table.
ulongsize != 8 ? 4294967291ul : (unsigned long)6442450933ull,
(unsigned long)8589934583ull,
(unsigned long)12884901857ull, (unsigned long)17179869143ull,
(unsigned long)25769803693ull, (unsigned long)34359738337ull,
(unsigned long)51539607367ull, (unsigned long)68719476731ull,
(unsigned long)103079215087ull, (unsigned long)137438953447ull,
(unsigned long)206158430123ull, (unsigned long)274877906899ull,
(unsigned long)412316860387ull, (unsigned long)549755813881ull,
(unsigned long)824633720731ull, (unsigned long)1099511627689ull,
(unsigned long)1649267441579ull, (unsigned long)2199023255531ull,
(unsigned long)3298534883309ull, (unsigned long)4398046511093ull,
(unsigned long)6597069766607ull, (unsigned long)8796093022151ull,
(unsigned long)13194139533241ull, (unsigned long)17592186044399ull,
(unsigned long)26388279066581ull, (unsigned long)35184372088777ull,
(unsigned long)52776558133177ull, (unsigned long)70368744177643ull,
(unsigned long)105553116266399ull, (unsigned long)140737488355213ull,
(unsigned long)211106232532861ull, (unsigned long)281474976710597ull,
(unsigned long)562949953421231ull, (unsigned long)1125899906842597ull,
(unsigned long)2251799813685119ull, (unsigned long)4503599627370449ull,
(unsigned long)9007199254740881ull, (unsigned long)18014398509481951ull,
(unsigned long)36028797018963913ull, (unsigned long)72057594037927931ull,
(unsigned long)144115188075855859ull,
(unsigned long)288230376151711717ull,
(unsigned long)576460752303423433ull,
(unsigned long)1152921504606846883ull,
(unsigned long)2305843009213693951ull,
(unsigned long)4611686018427387847ull,
(unsigned long)9223372036854775783ull,
(unsigned long)18446744073709551557ull,
(unsigned long)18446744073709551557ull
};
inline
@ -540,8 +582,8 @@ namespace Internal
prime_rehash_policy::
next_bkt(std::size_t n) const
{
const unsigned long* const last = X<0>::primes + X<0>::n_primes;
const unsigned long* p = std::lower_bound (X<0>::primes, last, n);
const unsigned long* const last = X<>::primes + X<>::n_primes;
const unsigned long* p = std::lower_bound(X<>::primes, last, n);
m_next_resize = static_cast<std::size_t>(std::ceil(*p * m_max_load_factor));
return *p;
}
@ -552,10 +594,10 @@ namespace Internal
prime_rehash_policy::
bkt_for_elements(std::size_t n) const
{
const unsigned long* const last = X<0>::primes + X<0>::n_primes;
const unsigned long* const last = X<>::primes + X<>::n_primes;
const float min_bkts = n / m_max_load_factor;
const unsigned long* p = std::lower_bound (X<0>::primes, last,
min_bkts, lt());
const unsigned long* p = std::lower_bound(X<>::primes, last,
min_bkts, lt());
m_next_resize = static_cast<std::size_t>(std::ceil(*p * m_max_load_factor));
return *p;
}
@ -578,10 +620,10 @@ namespace Internal
float min_bkts = (float(n_ins) + float(n_elt)) / m_max_load_factor;
if (min_bkts > n_bkt)
{
min_bkts = std::max (min_bkts, m_growth_factor * n_bkt);
const unsigned long* const last = X<0>::primes + X<0>::n_primes;
const unsigned long* p = std::lower_bound (X<0>::primes, last,
min_bkts, lt());
min_bkts = std::max(min_bkts, m_growth_factor * n_bkt);
const unsigned long* const last = X<>::primes + X<>::n_primes;
const unsigned long* p = std::lower_bound(X<>::primes, last,
min_bkts, lt());
m_next_resize =
static_cast<std::size_t>(std::ceil(*p * m_max_load_factor));
return std::make_pair(true, *p);
@ -631,15 +673,25 @@ namespace Internal
typedef typename Pair::second_type mapped_type;
mapped_type&
operator[](const K& k)
{
Hashtable* h = static_cast<Hashtable*>(this);
typename Hashtable::iterator it =
h->insert(std::make_pair(k, mapped_type())).first;
return it->second;
}
operator[](const K& k);
};
template<typename K, typename Pair, typename Hashtable>
typename map_base<K, Pair, extract1st<Pair>, true, Hashtable>::mapped_type&
map_base<K, Pair, extract1st<Pair>, true, Hashtable>::
operator[](const K& k)
{
Hashtable* h = static_cast<Hashtable*>(this);
typename Hashtable::hash_code_t code = h->m_hash_code(k);
std::size_t n = h->bucket_index(k, code, h->bucket_count());
typename Hashtable::node* p = h->m_find_node(h->m_buckets[n], k, code);
if (!p)
return h->m_insert_bucket(std::make_pair(k, mapped_type()),
n, code)->second;
return (p->m_v).second;
}
// class template rehash_base. Give hashtable the max_load_factor
// functions iff the rehash policy is prime_rehash_policy.
template<typename RehashPolicy, typename Hashtable>
@ -702,15 +754,15 @@ namespace Internal
std::size_t
bucket_index(const Key& k, hash_code_t, std::size_t N) const
{ return m_ranged_hash (k, N); }
{ return m_ranged_hash(k, N); }
std::size_t
bucket_index(const hash_node<Value, false>* p, std::size_t N) const
{ return m_ranged_hash (m_extract (p->m_v), N); }
{ return m_ranged_hash(m_extract(p->m_v), N); }
bool
compare(const Key& k, hash_code_t, hash_node<Value, false>* n) const
{ return m_eq (k, m_extract(n->m_v)); }
{ return m_eq(k, m_extract(n->m_v)); }
void
store_code(hash_node<Value, false>*, hash_code_t) const
@ -778,15 +830,15 @@ namespace Internal
std::size_t
bucket_index(const Key&, hash_code_t c, std::size_t N) const
{ return m_h2 (c, N); }
{ return m_h2(c, N); }
std::size_t
bucket_index(const hash_node<Value, false>* p, std::size_t N) const
{ return m_h2 (m_h1 (m_extract (p->m_v)), N); }
{ return m_h2(m_h1(m_extract(p->m_v)), N); }
bool
compare(const Key& k, hash_code_t, hash_node<Value, false>* n) const
{ return m_eq (k, m_extract(n->m_v)); }
{ return m_eq(k, m_extract(n->m_v)); }
void
store_code(hash_node<Value, false>*, hash_code_t) const
@ -840,11 +892,11 @@ namespace Internal
std::size_t
bucket_index(const Key&, hash_code_t c, std::size_t N) const
{ return m_h2 (c, N); }
{ return m_h2(c, N); }
std::size_t
bucket_index(const hash_node<Value, true>* p, std::size_t N) const
{ return m_h2 (p->hash_code, N); }
{ return m_h2(p->hash_code, N); }
bool
compare(const Key& k, hash_code_t c, hash_node<Value, true>* n) const
@ -986,6 +1038,9 @@ namespace tr1
cache_hash_code>
const_iterator;
template<typename K, typename Pair, typename Hashtable>
friend struct Internal::map_base;
private:
typedef Internal::hash_node<Value, cache_hash_code> node;
typedef typename Allocator::template rebind<node>::other
@ -1141,7 +1196,7 @@ namespace tr1
public: // lookup
iterator
find(const key_type&);
find(const key_type& k);
const_iterator
find(const key_type& k) const;
@ -1155,7 +1210,7 @@ namespace tr1
std::pair<const_iterator, const_iterator>
equal_range(const key_type& k) const;
private: // Insert and erase helper functions
private: // Find, insert and erase helper functions
// ??? This dispatching is a workaround for the fact that we don't
// have partial specialization of member templates; it would be
// better to just specialize insert on unique_keys. There may be a
@ -1171,25 +1226,26 @@ namespace tr1
Insert_Conv_Type;
node*
find_node(node* p, const key_type& k,
typename hashtable::hash_code_t c) const;
m_find_node(node*, const key_type&,
typename hashtable::hash_code_t) const;
iterator
m_insert_bucket(const value_type&, size_type,
typename hashtable::hash_code_t);
std::pair<iterator, bool>
insert(const value_type&, std::tr1::true_type);
m_insert(const value_type&, std::tr1::true_type);
iterator
insert(const value_type&, std::tr1::false_type);
m_insert(const value_type&, std::tr1::false_type);
void
erase_node(node*, node**);
m_erase_node(node*, node**);
public: // Insert and erase
Insert_Return_Type
insert(const value_type& v)
{
return this->insert(v, std::tr1::integral_constant<bool,
unique_keys>());
}
{ return m_insert(v, std::tr1::integral_constant<bool, unique_keys>()); }
iterator
insert(iterator, const value_type& v)
@ -1282,7 +1338,7 @@ namespace tr1
{
node* tmp = p;
p = p->m_next;
m_deallocate_node (tmp);
m_deallocate_node(tmp);
}
array[i] = 0;
}
@ -1300,8 +1356,8 @@ namespace tr1
// We allocate one extra bucket to hold a sentinel, an arbitrary
// non-null pointer. Iterator increment relies on this.
node** p = alloc.allocate(n+1);
std::fill(p, p+n, (node*) 0);
node** p = alloc.allocate(n + 1);
std::fill(p, p + n, (node*) 0);
p[n] = reinterpret_cast<node*>(0x1000);
return p;
}
@ -1315,7 +1371,7 @@ namespace tr1
m_deallocate_buckets(node** p, size_type n)
{
bucket_allocator_t alloc(m_node_allocator);
alloc.deallocate(p, n+1);
alloc.deallocate(p, n + 1);
}
template<typename K, typename V,
@ -1327,7 +1383,7 @@ namespace tr1
const H1& h1, const H2& h2, const H& h,
const Eq& eq, const Ex& exk,
const allocator_type& a)
: Internal::rehash_base<RP,hashtable>(),
: Internal::rehash_base<RP, hashtable>(),
Internal::hash_code_base<K, V, Ex, Eq, H1, H2, H, c>(exk, eq, h1, h2, h),
Internal::map_base<K, V, Ex, u, hashtable>(),
m_node_allocator(a),
@ -1350,12 +1406,12 @@ namespace tr1
const H1& h1, const H2& h2, const H& h,
const Eq& eq, const Ex& exk,
const allocator_type& a)
: Internal::rehash_base<RP,hashtable>(),
Internal::hash_code_base<K, V, Ex, Eq, H1, H2, H, c> (exk, eq,
h1, h2, h),
Internal::map_base<K,V,Ex,u,hashtable>(),
: Internal::rehash_base<RP, hashtable>(),
Internal::hash_code_base<K, V, Ex, Eq, H1, H2, H, c>(exk, eq,
h1, h2, h),
Internal::map_base<K, V, Ex, u, hashtable>(),
m_node_allocator(a),
m_bucket_count (0),
m_bucket_count(0),
m_element_count(0),
m_rehash_policy()
{
@ -1391,10 +1447,10 @@ namespace tr1
m_element_count(ht.m_element_count),
m_rehash_policy(ht.m_rehash_policy)
{
m_buckets = m_allocate_buckets (m_bucket_count);
m_buckets = m_allocate_buckets(m_bucket_count);
try
{
for (size_t i = 0; i < ht.m_bucket_count; ++i)
for (size_type i = 0; i < ht.m_bucket_count; ++i)
{
node* n = ht.m_buckets[i];
node** tail = m_buckets + i;
@ -1407,10 +1463,10 @@ namespace tr1
}
}
}
catch (...)
catch(...)
{
clear();
m_deallocate_buckets (m_buckets, m_bucket_count);
m_deallocate_buckets(m_buckets, m_bucket_count);
__throw_exception_again;
}
}
@ -1471,7 +1527,7 @@ namespace tr1
m_rehash_policy = pol;
size_type n_bkt = pol.bkt_for_elements(m_element_count);
if (n_bkt > m_bucket_count)
m_rehash (n_bkt);
m_rehash(n_bkt);
}
template<typename K, typename V,
@ -1484,7 +1540,7 @@ namespace tr1
{
typename hashtable::hash_code_t code = this->m_hash_code(k);
std::size_t n = this->bucket_index(k, code, this->bucket_count());
node* p = find_node(m_buckets[n], k, code);
node* p = m_find_node(m_buckets[n], k, code);
return p ? iterator(p, m_buckets + n) : this->end();
}
@ -1498,7 +1554,7 @@ namespace tr1
{
typename hashtable::hash_code_t code = this->m_hash_code(k);
std::size_t n = this->bucket_index(k, code, this->bucket_count());
node* p = find_node(m_buckets[n], k, code);
node* p = m_find_node(m_buckets[n], k, code);
return p ? const_iterator(p, m_buckets + n) : this->end();
}
@ -1512,8 +1568,8 @@ namespace tr1
{
typename hashtable::hash_code_t code = this->m_hash_code(k);
std::size_t n = this->bucket_index(k, code, this->bucket_count());
size_t result = 0;
for (node* p = m_buckets[n]; p ; p = p->m_next)
std::size_t result = 0;
for (node* p = m_buckets[n]; p; p = p->m_next)
if (this->compare(k, code, p))
++result;
return result;
@ -1533,13 +1589,13 @@ namespace tr1
typename hashtable::hash_code_t code = this->m_hash_code(k);
std::size_t n = this->bucket_index(k, code, this->bucket_count());
node** head = m_buckets + n;
node* p = find_node (*head, k, code);
node* p = m_find_node(*head, k, code);
if (p)
{
node* p1 = p->m_next;
for (; p1 ; p1 = p1->m_next)
if (!this->compare (k, code, p1))
for (; p1; p1 = p1->m_next)
if (!this->compare(k, code, p1))
break;
iterator first(p, head);
@ -1566,12 +1622,12 @@ namespace tr1
typename hashtable::hash_code_t code = this->m_hash_code(k);
std::size_t n = this->bucket_index(k, code, this->bucket_count());
node** head = m_buckets + n;
node* p = find_node(*head, k, code);
node* p = m_find_node(*head, k, code);
if (p)
{
node* p1 = p->m_next;
for (; p1 ; p1 = p1->m_next)
for (; p1; p1 = p1->m_next)
if (!this->compare(k, code, p1))
break;
@ -1593,15 +1649,54 @@ namespace tr1
bool c, bool ci, bool u>
typename hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::node*
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
find_node(node* p, const key_type& k,
typename hashtable::hash_code_t code) const
m_find_node(node* p, const key_type& k,
typename hashtable::hash_code_t code) const
{
for ( ; p ; p = p->m_next)
if (this->compare (k, code, p))
for (; p; p = p->m_next)
if (this->compare(k, code, p))
return p;
return false;
}
// Insert v in bucket n (assumes no element with its key already present).
template<typename K, typename V,
typename A, typename Ex, typename Eq,
typename H1, typename H2, typename H, typename RP,
bool c, bool ci, bool u>
typename hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::iterator
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
m_insert_bucket(const value_type& v, size_type n,
typename hashtable::hash_code_t code)
{
std::pair<bool, std::size_t> do_rehash
= m_rehash_policy.need_rehash(m_bucket_count, m_element_count, 1);
// Allocate the new node before doing the rehash so that we don't
// do a rehash if the allocation throws.
node* new_node = m_allocate_node(v);
try
{
if (do_rehash.first)
{
const key_type& k = this->m_extract(v);
n = this->bucket_index(k, code, do_rehash.second);
m_rehash(do_rehash.second);
}
new_node->m_next = m_buckets[n];
this->store_code(new_node, code);
m_buckets[n] = new_node;
++m_element_count;
return iterator(new_node, m_buckets + n);
}
catch(...)
{
m_deallocate_node(new_node);
__throw_exception_again;
}
}
// Insert v if no element with its key is already present.
template<typename K, typename V,
typename A, typename Ex, typename Eq,
@ -1610,43 +1705,17 @@ namespace tr1
std::pair<typename hashtable<K, V, A, Ex, Eq, H1,
H2, H, RP, c, ci, u>::iterator, bool>
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
insert(const value_type& v, std::tr1::true_type)
m_insert(const value_type& v, std::tr1::true_type)
{
const key_type& k = this->m_extract(v);
typename hashtable::hash_code_t code = this->m_hash_code(k);
size_type n = this->bucket_index(k, code, m_bucket_count);
if (node* p = find_node(m_buckets[n], k, code))
if (node* p = m_find_node(m_buckets[n], k, code))
return std::make_pair(iterator(p, m_buckets + n), false);
std::pair<bool, size_t> do_rehash
= m_rehash_policy.need_rehash(m_bucket_count, m_element_count, 1);
// Allocate the new node before doing the rehash so that we don't
// do a rehash if the allocation throws.
node* new_node = m_allocate_node (v);
try
{
if (do_rehash.first)
{
n = this->bucket_index(k, code, do_rehash.second);
m_rehash(do_rehash.second);
}
new_node->m_next = m_buckets[n];
this->store_code(new_node, code);
m_buckets[n] = new_node;
++m_element_count;
return std::make_pair(iterator(new_node, m_buckets + n), true);
}
catch (...)
{
m_deallocate_node (new_node);
__throw_exception_again;
}
return std::make_pair(m_insert_bucket(v, n, code), true);
}
// Insert v unconditionally.
template<typename K, typename V,
typename A, typename Ex, typename Eq,
@ -1654,7 +1723,7 @@ namespace tr1
bool c, bool ci, bool u>
typename hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::iterator
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
insert(const value_type& v, std::tr1::false_type)
m_insert(const value_type& v, std::tr1::false_type)
{
std::pair<bool, std::size_t> do_rehash
= m_rehash_policy.need_rehash(m_bucket_count, m_element_count, 1);
@ -1664,9 +1733,11 @@ namespace tr1
const key_type& k = this->m_extract(v);
typename hashtable::hash_code_t code = this->m_hash_code(k);
size_type n = this->bucket_index(k, code, m_bucket_count);
node* new_node = m_allocate_node (v);
node* prev = find_node(m_buckets[n], k, code);
// First find the node, avoid leaking new_node if compare throws.
node* prev = m_find_node(m_buckets[n], k, code);
node* new_node = m_allocate_node(v);
if (prev)
{
new_node->m_next = prev->m_next;
@ -1690,7 +1761,7 @@ namespace tr1
bool c, bool ci, bool u>
void
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
erase_node(node* p, node** b)
m_erase_node(node* p, node** b)
{
node* cur = *b;
if (cur == p)
@ -1706,7 +1777,7 @@ namespace tr1
cur->m_next = next->m_next;
}
m_deallocate_node (p);
m_deallocate_node(p);
--m_element_count;
}
@ -1719,14 +1790,14 @@ namespace tr1
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
insert(InIter first, InIter last)
{
size_type n_elt = Internal::distance_fw (first, last);
size_type n_elt = Internal::distance_fw(first, last);
std::pair<bool, std::size_t> do_rehash
= m_rehash_policy.need_rehash(m_bucket_count, m_element_count, n_elt);
if (do_rehash.first)
m_rehash(do_rehash.second);
for (; first != last; ++first)
this->insert (*first);
this->insert(*first);
}
template<typename K, typename V,
@ -1735,11 +1806,11 @@ namespace tr1
bool c, bool ci, bool u>
typename hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::iterator
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
erase(iterator i)
erase(iterator it)
{
iterator result = i;
iterator result = it;
++result;
erase_node(i.m_cur_node, i.m_cur_bucket);
m_erase_node(it.m_cur_node, it.m_cur_bucket);
return result;
}
@ -1749,11 +1820,11 @@ namespace tr1
bool c, bool ci, bool u>
typename hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::const_iterator
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
erase(const_iterator i)
erase(const_iterator it)
{
const_iterator result = i;
const_iterator result = it;
++result;
erase_node(i.m_cur_node, i.m_cur_bucket);
m_erase_node(it.m_cur_node, it.m_cur_bucket);
return result;
}
@ -1770,14 +1841,14 @@ namespace tr1
size_type result = 0;
node** slot = m_buckets + n;
while (*slot && ! this->compare(k, code, *slot))
while (*slot && !this->compare(k, code, *slot))
slot = &((*slot)->m_next);
while (*slot && this->compare(k, code, *slot))
{
node* n = *slot;
*slot = n->m_next;
m_deallocate_node (n);
node* p = *slot;
*slot = p->m_next;
m_deallocate_node(p);
--m_element_count;
++result;
}
@ -1845,31 +1916,31 @@ namespace tr1
bool c, bool ci, bool u>
void
hashtable<K, V, A, Ex, Eq, H1, H2, H, RP, c, ci, u>::
m_rehash(size_type N)
m_rehash(size_type n)
{
node** new_array = m_allocate_buckets (N);
node** new_array = m_allocate_buckets(n);
try
{
for (size_type i = 0; i < m_bucket_count; ++i)
while (node* p = m_buckets[i])
{
size_type new_index = this->bucket_index (p, N);
size_type new_index = this->bucket_index(p, n);
m_buckets[i] = p->m_next;
p->m_next = new_array[new_index];
new_array[new_index] = p;
}
m_deallocate_buckets(m_buckets, m_bucket_count);
m_bucket_count = N;
m_bucket_count = n;
m_buckets = new_array;
}
catch (...)
catch(...)
{
// A failure here means that a hash function threw an exception.
// We can't restore the previous state without calling the hash
// function again, so the only sensible recovery is to delete
// everything.
m_deallocate_nodes(new_array, N);
m_deallocate_buckets(new_array, N);
m_deallocate_nodes(new_array, n);
m_deallocate_buckets(new_array, n);
m_deallocate_nodes(m_buckets, m_bucket_count);
m_element_count = 0;
__throw_exception_again;

View File

@ -1,6 +1,6 @@
// TR1 type_traits -*- C++ -*-
// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 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
@ -98,6 +98,9 @@ namespace tr1
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template<typename _Tp, _Tp __v>
const _Tp integral_constant<_Tp, __v>::value;
/// @brief primary type categories [4.5.1].
template<typename>
struct is_void

View File

@ -87,10 +87,10 @@ my $cxx_regex = (join '|',@cxx_globs);
# Get all the symbols from the library, match them, and add them to a hash.
my %export_hash = ();
my $nm = $ENV{'NM_FOR_TARGET'} || "nm";
# Process each symbol.
print STDERR 'nm -P '.(join ' ',@ARGV).'|';
open NM,'nm -P '.(join ' ',@ARGV).'|' or die $!;
print STDERR $nm.' -P '.(join ' ',@ARGV).'|';
open NM,$nm.' -P '.(join ' ',@ARGV).'|' or die $!;
# Talk to c++filt through a pair of file descriptors.
open2(*FILTIN, *FILTOUT, "c++filt --strip-underscores") or die $!;
NAME: while (<NM>) {

View File

@ -0,0 +1,61 @@
// Copyright (C) 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 <tr1/unordered_map>
#include <testsuite_performance.h>
typedef std::tr1::unordered_map<int, int> map_type;
typedef std::tr1::unordered_map<int, map_type> matrix_type;
int main()
{
using namespace __gnu_test;
time_counter time;
resource_counter resource;
const int sz = 1000;
matrix_type matrix;
start_counters(time, resource);
for (int iter = 0; iter < 50; ++iter)
{
for (int i = 0; i < sz; ++i)
{
for (int j = 0; j < sz; ++j)
{
map_type& row = matrix[i / 4];
++row[j / 4];
}
}
}
stop_counters(time, resource);
report_performance(__FILE__, "", time, resource);
return 0;
}

View File

@ -0,0 +1,37 @@
// 2006-05-07 Paolo Carlini <pcarlini@suse.de>
//
// Copyright (C) 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.
// 4.3 Helper classes
#include <tr1/type_traits>
#include <testsuite_hooks.h>
void test01()
{
bool test __attribute__((unused)) = true;
const bool* p = &std::tr1::integral_constant<bool, true>::value;
VERIFY( p );
}
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,32 @@
// { dg-do compile }
// Copyright (C) 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.
// 6.3 Unordered associative containers
#include <tr1/unordered_set>
void
test01()
{
std::tr1::unordered_set<int>::iterator it;
std::tr1::unordered_set<int>::const_iterator cit;
std::tr1::unordered_set<int>::local_iterator lit;
std::tr1::unordered_set<int>::const_local_iterator clit;
}