diff --git a/gnu/dist/gcc4/libstdc++-v3/ChangeLog b/gnu/dist/gcc4/libstdc++-v3/ChangeLog index a61c5f8dd3ec..efc158fa924f 100644 --- a/gnu/dist/gcc4/libstdc++-v3/ChangeLog +++ b/gnu/dist/gcc4/libstdc++-v3/ChangeLog @@ -1,3 +1,84 @@ +2006-05-26 Paolo Carlini + + * include/tr1/hashtable: Minor cosmetic changes. + +2006-05-26 Paolo Carlini + + * 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 + + * 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 + + * include/tr1/hashtable (identity<>::operator(), + extract1st<>::operator()): Return by const ref. + +2006-05-11 Paolo Carlini + Peter Doerfler + + * 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 + + * include/tr1/type_traits (integral_constant<>::value): Define. + * testsuite/tr1/4_metaprogramming/helper_classes/static_definition.cc: + New. + +2006-05-03 Paolo Carlini + + * 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 + + 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 + + PR libstdc++/26513 + * scripts/make_exports.pl: Use $ENV{NM_FOR_TARGET}, if present. + +2006-04-21 Paolo Carlini + + 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 * docs/html/faq/index.html ([5.5]): Adjust to mention function diff --git a/gnu/dist/gcc4/libstdc++-v3/acinclude.m4 b/gnu/dist/gcc4/libstdc++-v3/acinclude.m4 index 1c70d34790e5..d91899665e09 100644 --- a/gnu/dist/gcc4/libstdc++-v3/acinclude.m4 +++ b/gnu/dist/gcc4/libstdc++-v3/acinclude.m4 @@ -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 ], - [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 of wcstoull, WEOF, etc. - AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) + # Check for the existence in 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 ]) AC_TRY_COMPILE([#include - #include - 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 ]) 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 ], + [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 + #include + 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]) ]) diff --git a/gnu/dist/gcc4/libstdc++-v3/configure b/gnu/dist/gcc4/libstdc++-v3/configure index 32e26393b335..2536b9d4049d 100644 --- a/gnu/dist/gcc4/libstdc++-v3/configure +++ b/gnu/dist/gcc4/libstdc++-v3/configure @@ -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 + #include + 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 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 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 " >&5 +echo $ECHO_N "checking for ISO C99 support in ... $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 - #include - 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 " >&5 -echo $ECHO_N "checking for ISO C99 support in ... $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" diff --git a/gnu/dist/gcc4/libstdc++-v3/configure.ac b/gnu/dist/gcc4/libstdc++-v3/configure.ac index a89f30593721..228bd8f85339 100644 --- a/gnu/dist/gcc4/libstdc++-v3/configure.ac +++ b/gnu/dist/gcc4/libstdc++-v3/configure.ac @@ -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]) diff --git a/gnu/dist/gcc4/libstdc++-v3/include/tr1/hashtable b/gnu/dist/gcc4/libstdc++-v3/include/tr1/hashtable index 052de36d6f6b..7b24d1bb2725 100644 --- a/gnu/dist/gcc4/libstdc++-v3/include/tr1/hashtable +++ b/gnu/dist/gcc4/libstdc++-v3/include/tr1/hashtable @@ -169,8 +169,11 @@ namespace Internal typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; + node_iterator() + : node_iterator_base(0) { } + explicit - node_iterator(hash_node* p = 0) + node_iterator(hash_node* p) : node_iterator_base(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(0) { } + explicit - node_const_iterator(hash_node* p = 0) + node_const_iterator(hash_node* p) : node_iterator_base(p) { } node_const_iterator(const node_iterator* node, hash_node** 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(0, 0) { } + hashtable_iterator(hash_node* p, hash_node** b) : hashtable_iterator_base(p, b) { } @@ -308,7 +316,7 @@ namespace Internal explicit hashtable_iterator(hash_node** b) : hashtable_iterator_base(*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(0, 0) { } + hashtable_const_iterator(hash_node* p, hash_node** b) : hashtable_iterator_base(p, b) { } @@ -350,7 +361,7 @@ namespace Internal explicit hashtable_const_iterator(hash_node** b) : hashtable_iterator_base(*b, b) { } - + hashtable_const_iterator(const hashtable_iterator& x) : hashtable_iterator_base(x.m_cur_node, x.m_cur_bucket) { } @@ -390,7 +401,7 @@ namespace Internal template struct identity { - T + const T& operator()(const T& t) const { return t; } }; @@ -398,7 +409,7 @@ namespace Internal template 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 + template 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 - const int X::n_primes; + template + const int X::n_primes; - template - const unsigned long X::primes[n_primes + 1] = + template + const unsigned long X::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::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::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::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(this); - typename Hashtable::iterator it = - h->insert(std::make_pair(k, mapped_type())).first; - return it->second; - } + operator[](const K& k); }; + template + typename map_base, true, Hashtable>::mapped_type& + map_base, true, Hashtable>:: + operator[](const K& k) + { + Hashtable* h = static_cast(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 @@ -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* 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* 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*, 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* 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* 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*, 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* 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* n) const @@ -986,6 +1038,9 @@ namespace tr1 cache_hash_code> const_iterator; + template + friend struct Internal::map_base; + private: typedef Internal::hash_node node; typedef typename Allocator::template rebind::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 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 - 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()); - } + { return m_insert(v, std::tr1::integral_constant()); } 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(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(), + : Internal::rehash_base(), Internal::hash_code_base(exk, eq, h1, h2, h), Internal::map_base(), 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(), - Internal::hash_code_base (exk, eq, - h1, h2, h), - Internal::map_base(), + : Internal::rehash_base(), + Internal::hash_code_base(exk, eq, + h1, h2, h), + Internal::map_base(), 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); } templatem_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::node* hashtable:: - 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 hashtable::iterator + hashtable:: + m_insert_bucket(const value_type& v, size_type n, + typename hashtable::hash_code_t code) + { + std::pair 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::iterator, bool> hashtable:: - 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 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 hashtable::iterator hashtable:: - insert(const value_type& v, std::tr1::false_type) + m_insert(const value_type& v, std::tr1::false_type) { std::pair 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:: - 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:: 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 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 hashtable::iterator hashtable:: - 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::const_iterator hashtable:: - 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:: - 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; diff --git a/gnu/dist/gcc4/libstdc++-v3/include/tr1/type_traits b/gnu/dist/gcc4/libstdc++-v3/include/tr1/type_traits index 70f3316a7bc4..72fd2b0dc9c9 100644 --- a/gnu/dist/gcc4/libstdc++-v3/include/tr1/type_traits +++ b/gnu/dist/gcc4/libstdc++-v3/include/tr1/type_traits @@ -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 true_type; typedef integral_constant false_type; + template + const _Tp integral_constant<_Tp, __v>::value; + /// @brief primary type categories [4.5.1]. template struct is_void diff --git a/gnu/dist/gcc4/libstdc++-v3/scripts/make_exports.pl b/gnu/dist/gcc4/libstdc++-v3/scripts/make_exports.pl index 5d1cd74a861e..a20b2dc6f4cd 100644 --- a/gnu/dist/gcc4/libstdc++-v3/scripts/make_exports.pl +++ b/gnu/dist/gcc4/libstdc++-v3/scripts/make_exports.pl @@ -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 () { diff --git a/gnu/dist/gcc4/libstdc++-v3/testsuite/performance/23_containers/insert/unordered_map_array.cc b/gnu/dist/gcc4/libstdc++-v3/testsuite/performance/23_containers/insert/unordered_map_array.cc new file mode 100644 index 000000000000..e682f362a0ae --- /dev/null +++ b/gnu/dist/gcc4/libstdc++-v3/testsuite/performance/23_containers/insert/unordered_map_array.cc @@ -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 +#include + +typedef std::tr1::unordered_map map_type; +typedef std::tr1::unordered_map 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; +} diff --git a/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/4_metaprogramming/helper_classes/static_definition.cc b/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/4_metaprogramming/helper_classes/static_definition.cc new file mode 100644 index 000000000000..bb2b3cd87cba --- /dev/null +++ b/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/4_metaprogramming/helper_classes/static_definition.cc @@ -0,0 +1,37 @@ +// 2006-05-07 Paolo Carlini +// +// 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 +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + const bool* p = &std::tr1::integral_constant::value; + VERIFY( p ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/6_containers/unordered/hashtable/iterators_default_constructor.cc b/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/6_containers/unordered/hashtable/iterators_default_constructor.cc new file mode 100644 index 000000000000..17705aee04ce --- /dev/null +++ b/gnu/dist/gcc4/libstdc++-v3/testsuite/tr1/6_containers/unordered/hashtable/iterators_default_constructor.cc @@ -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 + +void +test01() +{ + std::tr1::unordered_set::iterator it; + std::tr1::unordered_set::const_iterator cit; + std::tr1::unordered_set::local_iterator lit; + std::tr1::unordered_set::const_local_iterator clit; +}