diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2008-04-26 14:28:47 +0000 |
---|---|---|
committer | H.J. Lu <hongjiu.lu@intel.com> | 2008-04-26 14:28:47 +0000 |
commit | 3671107146f6d0e58e67224107ec97a524d27156 (patch) | |
tree | 41142492d6b0f089f563852fe2d8ebdea9a34885 /libstdc++-v3 | |
parent | 39d043c6ccb8de3e863d9ca7d04001d3b64dedb5 (diff) |
Merged with trunk at revision 134683.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/stack@134701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
34 files changed, 2609 insertions, 2103 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d597da06d31..23057295399 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,107 @@ +2008-04-25 Benjamin Kosnik <bkoz@redhat.com> + + PR libstdc++/35887 + * acinclude.m4: (GLIBCXX_ENABLE_PARALLEL): Check for thread support. + * configure.ac: Re-order compiler macros. + * configure: Regenerated. + +2008-04-24 Benjamin Kosnik <bkoz@redhat.com> + + PR libstdc++/35887 + * configure.ac: Add default argument to GLIBCXX_ENABLE_PARALLEL. + Move atomic warnings to GLIBCXX_ENABLE_ATOMIC_BUILTINS. + * acinclude.m4 (GLIBCXX_ENABLE_PARALLEL): Check for --disable-libgomp. + (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Add warning information. + * configure: Regenerate. + * include/Makefile.am (parallel_headers): Make conditional on + ENABLE_PARALLEL. + * include/Makefile.in: Regenerate. + +2008-04-24 Paolo Carlini <pcarlini@suse.de> + + PR libstdc++/35969 + * include/debug/list (merge): Use _M_transfer_iter, consistently + with the splice members. + * testsuite/23_containers/list/operations/35969.cc: New. + + * testsuite/23_containers/list/operators: Rename to + testsuite/23_containers/list/operations. + +2008-04-24 Benjamin Kosnik <bkoz@redhat.com> + + * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Check for set of + all used __sync builtins, in two sizes. + * config.h.in: Regenerate. + * configure: Regenerate. + * src/atomic.cc: Use _GLIBCXX_ATOMIC_BUILTINS_1. + * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS_4. + * libsupc++/guard.cc: Use _GLIBCXX_ATOMIC_BUILTINS_4. + * doc/xml/manual/concurrency.xm: Update docs. + +2008-04-23 Benjamin Kosnik <bkoz@redhat.com> + + * config/os/hpux/os_defines.h: Use _GLIBCXX_BEGIN_NAMESPACE, + _GLIBCXX_BEGIN_EXTERN_C, etc. + +2008-04-23 Johannes Singler <singler@ira.uka.de> + + * include/parallel/quicksort.h: Reformat, + (parallel_sort_qs): Do not pass number of elements. + * include/parallel/balanced_quicksort.h: Reformat, + (parallel_sort_qsb): Do not pass number of elements. + * include/parallel/tags.h: + Introduce new tags for compile-time choice. + * include/parallel/merge.h: + (parallel_merge_advance):Beautified. + * include/parallel/algo.h: Reformatting (spaces for tabs) + New sort and stable_sort variants, corresponding to the tags. + * include/parallel/sort.h: + New sort and stable_sort variants, corresponding to the tags. + Changed determining the desired number of threads. + +2008-04-23 Johannes Singler <singler@ira.uka.de> + + * include/parallel/multiway_merge.h + (multiway_merge_loser_tree): + Leave checks to callers, add precondition instead. + (multiway_merge_loser_tree_unguarded): Likewise. + (multiway_merge_loser_tree_sentinel): Likewise. + (sequential_multiway_merge): Added checks for total length 0. + (parallel_multiway_merge): Skip empty sequences. + (multiway_merge, all variants): + Remove temporary variable, return directly. + (stable_multiway_merge, all variants): Likewise. + (multiway_merge_sentinels, all variants): Likewise. + (stable_multiway_merge_sentinels, all variants): Likewise. + * include/parallel/multiseq_selection.h + (multiseq_partition): More detailed assertions. + +2008-04-21 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT, GLIBCXX_ENABLE_C99) + (GLIBCXX_CHECK_C99_TR1, GLIBCXX_CHECK_RANDOM_TR1) + (GLIBCXX_ENABLE_VISIBILITY): Fix cache variable names. + (GLIBCXX_CHECK_SYSTEM_ERROR): Likewise. Factorize. + * configure: Regenerate. + +2008-04-20 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + PR libstdc++/35954 + * include/Makefile.am (pch*_output): Do not touch pch*_output_anchor. + Call 'mkdir -p' unconditionally, but ignore its return value. + * include/Makefile.in: Regenerate. + + * include/Makefile.am: Fix most stamp rules to regenerate + the links for all sources newer than the stamp file. + * include/Makefile.in: Regenerate. + * Makefile.in: Likewise. + * src/Makefile.in: Likewise. + * doc/Makefile.in: Likewise. + * po/Makefile.in: Likewise. + * libmath/Makefile.in: Likewise. + * libsupc++/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + 2008-04-18 Paolo Bonzini <bonzini@gnu.org> PR bootstrap/35457 @@ -30,11 +134,11 @@ 2008-04-14 Benjamin Kosnik <bkoz@redhat.com> * include/bits/c++config: Guard _LDBL_ macros with __cplusplus. - + 2008-04-10 Benjamin Kosnik <bkoz@redhat.com> * doc/html/*: Regenerate. - + 2008-04-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * doc/xml/manual/bitmap_allocator.xml: Improve wording a bit. @@ -66,7 +170,7 @@ * doc/xml/manual/parallel_mode.xml: Remove map/set bulk insertors. Correct omp_set_num_threads example. - + 2008-04-10 Benjamin Kosnik <bkoz@redhat.com> * include/c_global/cstdatomic: C++ types only, format, doxygen markup. @@ -76,7 +180,7 @@ * include/Makefile.am (cstdatomic, stdatomic.h): Add. * src/Makefile.am (atomic.c): Add. * acinclude.m4 (GLIBCXX_CHECK_STANDARD_LAYOUT): New. - * configure.ac: Call it. + * configure.ac: Call it. * include/Makefile.in: Regenerate. * src/Makefile.in: Same. * Makefile.in: Same. @@ -88,21 +192,21 @@ * libsupc++/Makefile.in: Same. * config.h.in: Same. * configure: Same. - + * config/abi/pre/gnu.ver: Add atomics exports. * include/ext/typelist.h (apply_generator): New. * include/bits/c++config (_GLIBCXX_BEGIN_EXTERN_C): New. (_GLIBCXX_END_EXTERN_C): New. Deal with _GLIBCXX_BEGIN_NAMESPACE, _GLIBCXX_END_NAMESPACE when - compiling as C. + compiling as C. * testsuite/lib/libstdc++.exp (v3_target_compile_as_c): Add -L flag for libstdc++. * testsuite/util/testsuite_common_types.h (integral_types): New typelist. (atomics, atomics_tl): Same. (assignable, default_constructible, copy_constructible, - explicit_value_constructible): New. + explicit_value_constructible): New. * testsuite/17_intro/headers/c++200x/all.cc: Test new headers. * testsuite/29_atomics: New. * testsuite/29_atomics/atomic_address: Same. @@ -119,7 +223,7 @@ * testsuite/29_atomics/atomic_flag/cons/default.cc: Same. * testsuite/29_atomics/atomic_flag/cons/aggregate.cc: Same. * testsuite/29_atomics/atomic_flag/requirements: Same. - * testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc: + * testsuite/29_atomics/atomic_flag/requirements/standard_layout.cc: Same. * testsuite/29_atomics/atomic_flag/ atomic_global_fence_compatibility.cc: Same. @@ -148,7 +252,7 @@ * testsuite/29_atomics/atomic/requirements/explicit_instantiation: Same. * testsuite/29_atomics/atomic/requirements/explicit_instantiation/ 1.cc: Same. - + 2008-04-10 Lawrence Crowl <crowl@google.com> * include/c_global/cstdatomic: New. @@ -158,13 +262,13 @@ 2008-04-10 Benjamin Kosnik <bkoz@redhat.com> * include/std/tuple: Consistency check for include guard, doxygen - file markup. + file markup. * include/std/date_time: Same. * include/std/type_traits: Same. * include/std/regex: Same. * include/std/array: Same. - * include/std/system_error: Same, add error_code ctor. - + * include/std/system_error: Same, add error_code ctor. + 2008-04-07 Johannes Singler <singler@ira.uka.de> * include/parallel/multiway_merge.h: Moved decisions to @@ -286,7 +390,7 @@ * config/abi/compatibility.h: Adjust file name. * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust - line numbers. + line numbers. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. @@ -304,7 +408,7 @@ * testsuite/util/testsuite_abi.cc: Add support for not counting GLIBCXX_LDBL_* compat symbols missing if no long double compat symbols under test. - + 2008-03-20 Paolo Carlini <pcarlini@suse.de> PR libstdc++/35637 diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index a23c838c32a..d77cbc4b83f 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index b25c5add572..0b76efcc46b 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -360,7 +360,7 @@ AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) # Check for rlimit, setrlimit. - AC_CACHE_VAL(ac_setrlimit, [ + AC_CACHE_VAL(glibcxx_cv_setrlimit, [ AC_TRY_COMPILE( [#include <unistd.h> #include <sys/time.h> @@ -368,12 +368,12 @@ AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ ], [struct rlimit r; setrlimit(0, &r);], - [ac_setrlimit=yes], [ac_setrlimit=no]) + [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no]) ]) fi AC_MSG_CHECKING([for testsuite resource limits support]) - if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then + if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then ac_res_limits=yes AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, [Define if using setrlimit to set resource limits during @@ -801,7 +801,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ # Check for the existence of <math.h> functions used if C99 is enabled. AC_MSG_CHECKING([for ISO C99 support in <math.h>]) - AC_CACHE_VAL(ac_c99_math, [ + AC_CACHE_VAL(glibcxx_cv_c99_math, [ GCC_TRY_COMPILE_OR_LINK( [#include <math.h> volatile double d1, d2; @@ -819,10 +819,10 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ i = islessgreater(d1, d2); i = islessgreater(d1, d2); i = isunordered(d1, d2); - ],[ac_c99_math=yes], [ac_c99_math=no]) + ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no]) ]) - AC_MSG_RESULT($ac_c99_math) - if test x"$ac_c99_math" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_c99_math) + if test x"$glibcxx_cv_c99_math" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1, [Define if C99 functions or macros in <math.h> should be imported in <cmath> in namespace std.]) @@ -834,7 +834,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ # to the library function is emitted. AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no) AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) - ac_c99_complex=no; + glibcxx_cv_c99_complex=no; if test x"$ac_has_complex_h" = x"yes"; then AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) GCC_TRY_COMPILE_OR_LINK( @@ -884,10 +884,10 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ tmpld = ctanl(tmpld); tmpld = ctanhl(tmpld); tmpld = cpowl(tmpld, tmpld); - ],[ac_c99_complex=yes], [ac_c99_complex=no]) + ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no]) fi - AC_MSG_RESULT($ac_c99_complex) - if test x"$ac_c99_complex" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_c99_complex) + if test x"$glibcxx_cv_c99_complex" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1, [Define if C99 functions in <complex.h> should be used in <complex>. Using compiler builtins for these functions requires @@ -896,7 +896,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ # Check for the existence in <stdio.h> of vscanf, et. al. AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) - AC_CACHE_VAL(ac_c99_stdio, [ + AC_CACHE_VAL(glibcxx_cv_c99_stdio, [ GCC_TRY_COMPILE_OR_LINK( [#include <stdio.h> #include <stdarg.h> @@ -909,13 +909,13 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ vsscanf(fmt, "%i", args); }], [snprintf("12", 0, "%i");], - [ac_c99_stdio=yes], [ac_c99_stdio=no]) + [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no]) ]) - AC_MSG_RESULT($ac_c99_stdio) + AC_MSG_RESULT($glibcxx_cv_c99_stdio) # Check for the existence in <stdlib.h> of lldiv_t, et. al. AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) - AC_CACHE_VAL(ac_c99_stdlib, [ + AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [ GCC_TRY_COMPILE_OR_LINK( [#include <stdlib.h> volatile float f; @@ -933,12 +933,12 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ll = mydivt.rem; ll = atoll("10"); _Exit(0); - ],[ac_c99_stdlib=yes], [ac_c99_stdlib=no]) + ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no]) ]) - AC_MSG_RESULT($ac_c99_stdlib) + AC_MSG_RESULT($glibcxx_cv_c99_stdlib) # Check for the existence in <wchar.h> of wcstold, etc. - ac_c99_wchar=no; + glibcxx_cv_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>]) @@ -949,7 +949,7 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ using ::wcstoll; using ::wcstoull; } - ],[],[ac_c99_wchar=yes], [ac_c99_wchar=no]) + ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no]) # Checks for wide character functions that may not be present. # Injection of these is wrapped with guard macros. @@ -978,15 +978,15 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ [AC_DEFINE(HAVE_ISWBLANK,1, [Defined if iswblank exists.])],[]) - AC_MSG_RESULT($ac_c99_wchar) + AC_MSG_RESULT($glibcxx_cv_c99_wchar) fi # Option parsed, now set things appropriately. - if test x"$ac_c99_math" = x"no" || - test x"$ac_c99_complex" = x"no" || - test x"$ac_c99_stdio" = x"no" || - test x"$ac_c99_stdlib" = x"no" || - test x"$ac_c99_wchar" = x"no"; then + if test x"$glibcxx_cv_c99_math" = x"no" || + test x"$glibcxx_cv_c99_complex" = x"no" || + test x"$glibcxx_cv_c99_stdio" = x"no" || + test x"$glibcxx_cv_c99_stdlib" = x"no" || + test x"$glibcxx_cv_c99_wchar" = x"no"; then enable_c99=no; else AC_DEFINE(_GLIBCXX_USE_C99, 1, @@ -1059,15 +1059,15 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ # Check for the existence of <ctype.h> functions. AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>]) - AC_CACHE_VAL(ac_c99_ctype_tr1, [ + AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [ AC_TRY_COMPILE([#include <ctype.h>], [int ch; int ret; ret = isblank(ch); - ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no]) + ],[glibcxx_cv_c99_ctype_tr1=yes], [glibcxx_cv_c99_ctype_tr1=no]) ]) - AC_MSG_RESULT($ac_c99_ctype_tr1) - if test x"$ac_c99_ctype_tr1" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1) + if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1, [Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in namespace std::tr1.]) @@ -1105,7 +1105,7 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ # Check for the existence of <stdint.h> types. AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>]) - AC_CACHE_VAL(ac_c99_stdint_tr1, [ + AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [ AC_TRY_COMPILE([#include <stdint.h>], [typedef int8_t my_int8_t; typedef int16_t my_int16_t; @@ -1135,10 +1135,10 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ typedef uint_least64_t my_uint_least64_t; typedef uintmax_t my_uintmax_t; typedef uintptr_t my_uintptr_t; - ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no]) + ],[glibcxx_cv_c99_stdint_tr1=yes], [glibcxx_cv_c99_stdint_tr1=no]) ]) - AC_MSG_RESULT($ac_c99_stdint_tr1) - if test x"$ac_c99_stdint_tr1" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1) + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1, [Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in namespace std::tr1.]) @@ -1146,7 +1146,7 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ # Check for the existence of <math.h> functions. AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>]) - AC_CACHE_VAL(ac_c99_math_tr1, [ + AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [ AC_TRY_COMPILE([#include <math.h>], [typedef double_t my_double_t; typedef float_t my_float_t; @@ -1255,10 +1255,10 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ trunc(0.0); truncf(0.0f); truncl(0.0l); - ],[ac_c99_math_tr1=yes], [ac_c99_math_tr1=no]) + ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no]) ]) - AC_MSG_RESULT($ac_c99_math_tr1) - if test x"$ac_c99_math_tr1" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_c99_math_tr1) + if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, [Define if C99 functions or macros in <math.h> should be imported in <tr1/cmath> in namespace std::tr1.]) @@ -1267,7 +1267,7 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ # Check for the existence of <inttypes.h> functions (NB: doesn't make # sense if the previous check fails, per C99, 7.8/1). ac_c99_inttypes_tr1=no; - if test x"$ac_c99_stdint_tr1" = x"yes"; then + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>]) AC_TRY_COMPILE([#include <inttypes.h>], [intmax_t i, numer, denom, base; @@ -1300,7 +1300,7 @@ dnl AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [ AC_MSG_CHECKING([for "dev/random" and "dev/urandom" for TR1 random_device]) - AC_CACHE_VAL(ac_random_tr1, [ + AC_CACHE_VAL(glibcxx_cv_random_tr1, [ AC_TRY_RUN([#include <stdio.h> int main() { @@ -1308,11 +1308,11 @@ AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [ && fopen("/dev/urandom", "r")); } ], - [ac_random_tr1=yes], [ac_random_tr1=no], - [ac_random_tr1=no]) + [glibcxx_cv_random_tr1=yes], [glibcxx_cv_random_tr1=no], + [glibcxx_cv_random_tr1=no]) ]) - AC_MSG_RESULT($ac_random_tr1) - if test x"$ac_random_tr1" = x"yes"; then + AC_MSG_RESULT($glibcxx_cv_random_tr1) + if test x"$glibcxx_cv_random_tr1" = x"yes"; then AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1, [Define if dev/random and dev/urandom are available for the random_device of TR1 (Chapter 5.1).]) @@ -1325,155 +1325,26 @@ dnl Check whether macros, etc are present for <system_error> dnl AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [ - AC_MSG_CHECKING([for EOWNERDEAD]) - AC_CACHE_VAL(ac_system_error1, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = EOWNERDEAD; ], - [ac_system_error1=yes], [ac_system_error1=no]) - ]) - AC_MSG_RESULT($ac_system_error1) - if test x"$ac_system_error1" = x"yes"; then - AC_DEFINE(HAVE_EOWNERDEAD, 1, [Define if EOWNERDEAD exists.]) - fi - - AC_MSG_CHECKING([for ENOTRECOVERABLE]) - AC_CACHE_VAL(ac_system_error2, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOTRECOVERABLE; ], - [ac_system_error2=yes], [ac_system_error2=no]) - ]) - AC_MSG_RESULT($ac_system_error2) - if test x"$ac_system_error2" = x"yes"; then - AC_DEFINE(HAVE_ENOTRECOVERABLE, 1, [Define if ENOTRECOVERABLE exists.]) - fi - - AC_MSG_CHECKING([for ENOLINK]) - AC_CACHE_VAL(ac_system_error3, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOLINK; ], - [ac_system_error3=yes], [ac_system_error3=no]) - ]) - AC_MSG_RESULT($ac_system_error3) - if test x"$ac_system_error3" = x"yes"; then - AC_DEFINE(HAVE_ENOLINK, 1, [Define if ENOLINK exists.]) - fi - - AC_MSG_CHECKING([for EPROTO]) - AC_CACHE_VAL(ac_system_error_4, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = EPROTO; ], - [ac_system_error_4=yes], [ac_system_error_4=no]) - ]) - AC_MSG_RESULT($ac_system_error_4) - if test x"$ac_system_error_4" = x"yes"; then - AC_DEFINE(HAVE_EPROTO, 1, [Define if EPROTO exists.]) - fi - - AC_MSG_CHECKING([for ENODATA]) - AC_CACHE_VAL(ac_system_error_5, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENODATA; ], - [ac_system_error_5=yes], [ac_system_error_5=no]) - ]) - AC_MSG_RESULT($ac_system_error_5) - if test x"$ac_system_error_5" = x"yes"; then - AC_DEFINE(HAVE_ENODATA, 1, [Define if ENODATA exists.]) - fi - - AC_MSG_CHECKING([for ENOSR]) - AC_CACHE_VAL(ac_system_error_6, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSR; ], - [ac_system_error_6=yes], [ac_system_error_6=no]) - ]) - AC_MSG_RESULT($ac_system_error_6) - if test x"$ac_system_error_6" = x"yes"; then - AC_DEFINE(HAVE_ENOSR, 1, [Define if ENOSR exists.]) - fi - - AC_MSG_CHECKING([for ENOSTR]) - AC_CACHE_VAL(ac_system_error_7, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSTR; ], - [ac_system_error_7=yes], [ac_system_error_7=no]) - ]) - AC_MSG_RESULT($ac_system_error_7) - if test x"$ac_system_error_7" = x"yes"; then - AC_DEFINE(HAVE_ENOSTR, 1, [Define if ENOSTR exists.]) - fi - - AC_MSG_CHECKING([for ETIME]) - AC_CACHE_VAL(ac_system_error_8, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ETIME; ], - [ac_system_error_8=yes], [ac_system_error_8=no]) - ]) - AC_MSG_RESULT($ac_system_error_8) - if test x"$ac_system_error_8" = x"yes"; then - AC_DEFINE(HAVE_ETIME, 1, [Define if ETIME exists.]) - fi - - AC_MSG_CHECKING([for sys_nerr]) - AC_CACHE_VAL(ac_system_error9, [ - AC_TRY_COMPILE([#include <errno.h> ], [ int i = sys_nerr; ], - [ac_system_error9=yes], [ac_system_error9=no]) - ]) - AC_MSG_RESULT($ac_system_error9) - if test x"$ac_system_error9" = x"yes"; then - AC_DEFINE(HAVE_SYS_NERR, 1, [Define if sys_nerr exists.]) - fi - - AC_MSG_CHECKING([for EBADMSG]) - AC_CACHE_VAL(ac_system_error_10, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = EBADMSG; ], - [ac_system_error_10=yes], [ac_system_error_10=no]) - ]) - AC_MSG_RESULT($ac_system_error_10) - if test x"$ac_system_error_10" = x"yes"; then - AC_DEFINE(HAVE_EBADMSG, 1, [Define if EBADMSG exists.]) - fi - - AC_MSG_CHECKING([for ECANCELED]) - AC_CACHE_VAL(ac_system_error_11, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ECANCELED; ], - [ac_system_error_11=yes], [ac_system_error_11=no]) - ]) - AC_MSG_RESULT($ac_system_error_11) - if test x"$ac_system_error_11" = x"yes"; then - AC_DEFINE(HAVE_ECANCELED, 1, [Define if ECANCELED exists.]) - fi - - AC_MSG_CHECKING([for EOVERFLOW]) - AC_CACHE_VAL(ac_system_error_12, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = EOVERFLOW; ], - [ac_system_error_12=yes], [ac_system_error_12=no]) - ]) - AC_MSG_RESULT($ac_system_error_12) - if test x"$ac_system_error_12" = x"yes"; then - AC_DEFINE(HAVE_EOVERFLOW, 1, [Define if EOVERFLOW exists.]) - fi - - AC_MSG_CHECKING([for ENOTSUP]) - AC_CACHE_VAL(ac_system_error_13, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOTSUP; ], - [ac_system_error_13=yes], [ac_system_error_13=no]) - ]) - AC_MSG_RESULT($ac_system_error_13) - if test x"$ac_system_error_13" = x"yes"; then - AC_DEFINE(HAVE_ENOTSUP, 1, [Define if ENOTSUP exists.]) - fi - - AC_MSG_CHECKING([for EIDRM]) - AC_CACHE_VAL(ac_system_error_14, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = EIDRM; ], - [ac_system_error_14=yes], [ac_system_error_14=no]) - ]) - AC_MSG_RESULT($ac_system_error_14) - if test x"$ac_system_error_14" = x"yes"; then - AC_DEFINE(HAVE_EIDRM, 1, [Define if EIDRM exists.]) - fi - - AC_MSG_CHECKING([for ETXTBSY]) - AC_CACHE_VAL(ac_system_error_15, [ - AC_TRY_COMPILE([#include <errno.h>], [ int i = ETXTBSY; ], - [ac_system_error_15=yes], [ac_system_error_15=no]) - ]) - AC_MSG_RESULT($ac_system_error_15) - if test x"$ac_system_error_15" = x"yes"; then - AC_DEFINE(HAVE_ETXTBSY, 1, [Define if ETXTBSY exists.]) - fi +m4_pushdef([n_syserr], [1])dnl +m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA, + ENOSR, ENOSTR, ETIME, sys_nerr, EBADMSG, ECANCELED, + EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY], +[m4_pushdef([SYSERR], m4_toupper(syserr))dnl +AC_MSG_CHECKING([for syserr]) +AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], + [int i = syserr;])], + [glibcxx_cv_system_error[]n_syserr=yes], + [glibcxx_cv_system_error[]n_syserr=no]) +]) +AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr]) +if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then + AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.]) +fi +m4_define([n_syserr], m4_incr(n_syserr))dnl +m4_popdef([SYSERR])dnl +]) +m4_popdef([n_syserr])dnl ]) dnl @@ -1875,22 +1746,22 @@ dnl + Usage: GLIBCXX_ENABLE_PARALLEL dnl AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [ - # NB: libstdc++ may be configured before libgomp: can't check for the actual - # dependencies (omp.h and libgomp). enable_parallel=no; - if test -f $glibcxx_builddir/../libgomp/omp.h; then - enable_parallel=yes; - else - AC_MSG_NOTICE([$glibcxx_builddir/../libgomp/omp.h not found]) - fi - # Check to see if it's explicitly disabled. -# GLIBCXX_ENABLE(libgomp,$1,,[enable code depending on libgomp], -# [permit yes|no]) + # Check to see if threads are disabled. + # Requires GLIBCXX_ENABLE_THREADS. + if test x$enable_thread = xyes; then + + # Check to see if OpenMP is disabled. + AC_MSG_CHECKING([for libgomp support]) + GLIBCXX_ENABLE(libgomp,$1,,[enable code depending on libgomp], + [permit yes|no]) + AC_MSG_RESULT([$enable_libgomp]) + if test x$enable_libgomp = xyes; then + enable_parallel=yes + fi -# if test x$enable_libgomp = xno; then -# enable_parallel=no -# fi + fi AC_MSG_CHECKING([for parallel mode support]) AC_MSG_RESULT([$enable_parallel]) @@ -2258,23 +2129,29 @@ dnl See: dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins dnl dnl This checks to see if the host supports the compiler-generated -dnl builtins for atomic operations. Note, this is intended to be an -dnl all-or-nothing switch, so all the atomic operations that are used -dnl should be checked. +dnl builtins for atomic operations for various integral sizes. Note, this +dnl is intended to be an all-or-nothing switch, so all the atomic operations +dnl that are used should be checked. dnl dnl Note: dnl libgomp and libgfortran do this with a link test, instead of an asm test. dnl see: CHECK_SYNC_FETCH_AND_ADD dnl dnl Defines: -dnl _GLIBCXX_ATOMIC_BUILTINS if the compiler on this target supports atomics. +dnl _GLIBCXX_ATOMIC_BUILTINS_1 +dnl _GLIBCXX_ATOMIC_BUILTINS_4 dnl AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ - AC_MSG_CHECKING([for atomic builtins]) AC_LANG_SAVE AC_LANG_CPLUSPLUS + old_CXXFLAGS="$CXXFLAGS" + + # Compile unoptimized. + CXXFLAGS='-O0 -S' + + # Fake what AC_TRY_COMPILE does, without linking as this is + # unnecessary for a builtins test. - # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF [#]line __oline__ "configure" int main() @@ -2284,34 +2161,79 @@ int main() atomic_type c1; atomic_type c2; const atomic_type c3(0); - if (__sync_fetch_and_add(&c1, c2) == c3) - { - // Do something. - } - return 0; + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize(); + return 0; } EOF - old_CXXFLAGS="$CXXFLAGS" - CXXFLAGS='-O0 -S' + + AC_MSG_CHECKING([for atomic builtins for int]) if AC_TRY_EVAL(ac_compile); then - if grep __sync_fetch_and_add conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtins=no + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsi=no else - AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, - [Define if builtin atomic operations are supported on this host.]) - enable_atomic_builtins=yes - atomicity_dir=cpu/generic/atomicity_builtins + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1, + [Define if builtin atomic operations for int are supported on this host.]) + enable_atomic_builtinsi=yes fi fi - AC_MSG_RESULT($enable_atomic_builtins) - CXXFLAGS="$old_CXXFLAGS" + AC_MSG_RESULT($enable_atomic_builtinsi) + rm -f conftest* + + cat > conftest.$ac_ext << EOF +[#]line __oline__ "configure" +int main() +{ + typedef bool atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize(); + return 0; +} +EOF + + AC_MSG_CHECKING([for atomic builtins for bool]) + if AC_TRY_EVAL(ac_compile); then + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsb=no + else + AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1, + [Define if builtin atomic operations for bool are supported on this host.]) + enable_atomic_builtinsb=yes + fi + fi + AC_MSG_RESULT($enable_atomic_builtinsb) rm -f conftest* - # Now, if still generic, set to mutex. + CXXFLAGS="$old_CXXFLAGS" + AC_LANG_RESTORE + + # Set atomicity_dir to builtins if either of above tests pass. + if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then + atomicity_dir=cpu/generic/atomicity_builtins + fi + + # If still generic, set to mutex. if test $atomicity_dir = "cpu/generic" ; then - atomicity_dir=cpu/generic/atomicity_mutex + atomicity_dir=cpu/generic/atomicity_mutex + AC_MSG_WARN([No native atomic operations are provided for this platform.]) + if test $target_thread_file = single; then + AC_MSG_WARN([They cannot be faked when thread support is disabled.]) + AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.]) + else + AC_MSG_WARN([They will be faked using a mutex.]) + AC_MSG_WARN([Performance of certain classes will degrade as a result.]) + fi fi - AC_LANG_RESTORE + ]) @@ -2401,14 +2323,14 @@ if test x$enable_visibility = xyes ; then dnl all hail libgfortran dnl Check whether the target supports hidden visibility. AC_CACHE_CHECK([whether the target supports hidden visibility], - have_attribute_visibility, [ + glibcxx_cv_have_attribute_visibility, [ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }], - [], have_attribute_visibility=yes, - have_attribute_visibility=no) + [], glibcxx_cv_have_attribute_visibility=yes, + glibcxx_cv_have_attribute_visibility=no) CFLAGS="$save_CFLAGS"]) - if test $have_attribute_visibility = no; then + if test $glibcxx_cv_have_attribute_visibility = no; then enable_visibility=no fi fi diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 52acd2c2f0d..d4eee4482ff 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -719,14 +719,32 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* The size of a `char', as computed by sizeof. */ +#undef SIZEOF_CHAR + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of a `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION -/* Define if builtin atomic operations are supported on this host. */ -#undef _GLIBCXX_ATOMIC_BUILTINS +/* Define if builtin atomic operations for bool are supported on this host. */ +#undef _GLIBCXX_ATOMIC_BUILTINS_1 + +/* Define if builtin atomic operations for int are supported on this host. */ +#undef _GLIBCXX_ATOMIC_BUILTINS_4 /* Define to use concept checking code from the boost libraries. */ #undef _GLIBCXX_CONCEPT_CHECKS diff --git a/libstdc++-v3/config/os/hpux/os_defines.h b/libstdc++-v3/config/os/hpux/os_defines.h index 6118a2671dd..515f42182b0 100644 --- a/libstdc++-v3/config/os/hpux/os_defines.h +++ b/libstdc++-v3/config/os/hpux/os_defines.h @@ -1,6 +1,6 @@ // Specific definitions for HPUX -*- C++ -*- -// Copyright (C) 2000, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2000, 2002, 2004, 2005, 2008 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 @@ -61,20 +61,24 @@ We also force _GLIBCXX_USE_LONG_LONG here so that we don't have to bastardize configure to deal with this sillyness. */ -namespace std -{ + +_GLIBCXX_BEGIN_NAMESPACE(std) +_GLIBCXX_BEGIN_EXTERN_C + #ifndef __LP64__ - __extension__ extern "C" long long strtoll (const char *, char **, int) + __extension__ long long strtoll (const char *, char **, int) __asm ("__strtoll"); - __extension__ extern "C" unsigned long long strtoull (const char *, char **, int) + __extension__ unsigned long long strtoull (const char *, char **, int) __asm ("__strtoull"); #else - __extension__ extern "C" long long strtoll (const char *, char **, int) + __extension__ long long strtoll (const char *, char **, int) __asm ("strtol"); - __extension__ extern "C" unsigned long long strtoull (const char *, char **, int) + __extension__ unsigned long long strtoull (const char *, char **, int) __asm ("strtoul"); #endif -} + +_GLIBCXX_END_EXTERN_C +_GLIBCXX_END_NAMESPACE #define _GLIBCXX_USE_LONG_LONG 1 diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 4426c090d4e..ded1ca36a66 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -458,7 +458,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1045,6 +1045,7 @@ Optional Features: [default="-g3 -O0"] --enable-libstdcxx-debug build extra debug library [default=no] + --enable-libgomp enable code depending on libgomp [default=yes] --enable-cxx-flags=FLAGS pass compiler FLAGS when building library [default=] @@ -4666,13 +4667,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4669: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4670: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4672: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4673: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4675: output\"" >&5) + (eval echo "\"\$as_me:4676: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5716,7 +5717,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5719 "configure"' > conftest.$ac_ext + echo '#line 5720 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7178,11 +7179,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7181: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7182: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7185: \$? = $ac_status" >&5 + echo "$as_me:7186: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7500,11 +7501,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7503: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7504: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7507: \$? = $ac_status" >&5 + echo "$as_me:7508: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7605,11 +7606,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7608: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7609: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7612: \$? = $ac_status" >&5 + echo "$as_me:7613: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7660,11 +7661,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7663: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7664: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7667: \$? = $ac_status" >&5 + echo "$as_me:7668: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10512,7 +10513,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10515 "configure" +#line 10516 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10612,7 +10613,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10615 "configure" +#line 10616 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12650,11 +12651,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12653: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12654: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12657: \$? = $ac_status" >&5 + echo "$as_me:12658: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12749,11 +12750,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12752: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12753: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12756: \$? = $ac_status" >&5 + echo "$as_me:12757: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12801,11 +12802,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12804: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12805: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12808: \$? = $ac_status" >&5 + echo "$as_me:12809: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13850,7 +13851,7 @@ fi; # # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 13853 "configure" +#line 13854 "configure" struct S { ~S(); }; void bar(); void foo() @@ -13979,6 +13980,354 @@ echo "${ECHO_T}$enable_libstdcxx_pch" >&6 + + + 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 + + old_CXXFLAGS="$CXXFLAGS" + + # Compile unoptimized. + CXXFLAGS='-O0 -S' + + # Fake what AC_TRY_COMPILE does, without linking as this is + # unnecessary for a builtins test. + + cat > conftest.$ac_ext << EOF +#line 14000 "configure" +int main() +{ + // NB: _Atomic_word not necessarily int. + typedef int atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize(); + return 0; +} +EOF + + echo "$as_me:$LINENO: checking for atomic builtins for int" >&5 +echo $ECHO_N "checking for atomic builtins for int... $ECHO_C" >&6 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsi=no + else + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_ATOMIC_BUILTINS_4 1 +_ACEOF + + enable_atomic_builtinsi=yes + fi + fi + echo "$as_me:$LINENO: result: $enable_atomic_builtinsi" >&5 +echo "${ECHO_T}$enable_atomic_builtinsi" >&6 + rm -f conftest* + + cat > conftest.$ac_ext << EOF +#line 14040 "configure" +int main() +{ + typedef bool atomic_type; + atomic_type c1; + atomic_type c2; + const atomic_type c3(0); + __sync_fetch_and_add(&c1, c2); + __sync_val_compare_and_swap(&c1, c3, c2); + __sync_lock_test_and_set(&c1, c3); + __sync_lock_release(&c1); + __sync_synchronize(); + return 0; +} +EOF + + echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5 +echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsb=no + else + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_ATOMIC_BUILTINS_1 1 +_ACEOF + + enable_atomic_builtinsb=yes + fi + fi + echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5 +echo "${ECHO_T}$enable_atomic_builtinsb" >&6 + rm -f conftest* + + CXXFLAGS="$old_CXXFLAGS" + 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 + + + # Set atomicity_dir to builtins if either of above tests pass. + if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then + atomicity_dir=cpu/generic/atomicity_builtins + fi + + # If still generic, set to mutex. + if test $atomicity_dir = "cpu/generic" ; then + atomicity_dir=cpu/generic/atomicity_mutex + { echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5 +echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;} + if test $target_thread_file = single; then + { echo "$as_me:$LINENO: WARNING: They cannot be faked when thread support is disabled." >&5 +echo "$as_me: WARNING: They cannot be faked when thread support is disabled." >&2;} + { echo "$as_me:$LINENO: WARNING: Thread-safety of certain classes is not guaranteed." >&5 +echo "$as_me: WARNING: Thread-safety of certain classes is not guaranteed." >&2;} + else + { echo "$as_me:$LINENO: WARNING: They will be faked using a mutex." >&5 +echo "$as_me: WARNING: They will be faked using a mutex." >&2;} + { echo "$as_me:$LINENO: WARNING: Performance of certain classes will degrade as a result." >&5 +echo "$as_me: WARNING: Performance of certain classes will degrade as a result." >&2;} + fi + fi + + + + echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 +echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 + target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` + echo "$as_me:$LINENO: result: $target_thread_file" >&5 +echo "${ECHO_T}$target_thread_file" >&6 + + if test $target_thread_file != single; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GTHR_DEFAULT 1 +_ACEOF + + fi + + glibcxx_thread_h=gthr-$target_thread_file.h + + gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} + if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then + enable_thread=yes + else + enable_thread=no + fi + + + + +# Checks for compiler support that don't require linking. + + # All these tests are for C++; save the language and the compiler flags. + # The CXXFLAGS thing is suspicious, but based on similar bits previously + # found in GLIBCXX_CONFIGURE. + + + 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 + + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + + # Check for maintainer-mode bits. + if test x"$USE_MAINTAINER_MODE" = xno; then + WERROR='' + else + WERROR='-Werror' + fi + + # Check for -ffunction-sections -fdata-sections + echo "$as_me:$LINENO: checking for g++ that supports -ffunction-sections -fdata-sections" >&5 +echo $ECHO_N "checking for g++ that supports -ffunction-sections -fdata-sections... $ECHO_C" >&6 + CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo; void bar() { }; +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 + ac_fdsections=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_fdsections=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" + else + # this is the suspicious part + CXXFLAGS='' + fi + if test x"$ac_fdsections" = x"yes"; then + SECTION_FLAGS='-ffunction-sections -fdata-sections' + fi + echo "$as_me:$LINENO: result: $ac_fdsections" >&5 +echo "${ECHO_T}$ac_fdsections" >&6 + + 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 + + + + + + + echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5 +echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6 + if test "${ac_standard_layout+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + + 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 + + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS='-std=gnu++0x' + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +struct b + { + bool t; + + // Need standard layout relaxation from POD + private: + b& operator=(const b&); + b(const b&); + }; + + int main() + { + b tst1 = { false }; + return 0; + } +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 + ac_standard_layout=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_standard_layout=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS="$ac_save_CXXFLAGS" + 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 + + echo "$as_me:$LINENO: result: $ac_standard_layout" >&5 +echo "${ECHO_T}$ac_standard_layout" >&6 + if test x"$ac_standard_layout" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_USE_STANDARD_LAYOUT 1 +_ACEOF + + fi + + # Enable all the variable C++ runtime options that doesn't require linking. echo "$as_me:$LINENO: checking for underlying I/O to use" >&5 @@ -15558,7 +15907,7 @@ fi # Check for the existence of <math.h> functions used if C99 is enabled. echo "$as_me:$LINENO: checking for ISO C99 support in <math.h>" >&5 echo $ECHO_N "checking for ISO C99 support in <math.h>... $ECHO_C" >&6 - if test "${ac_c99_math+set}" = set; then + if test "${glibcxx_cv_c99_math+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -15615,12 +15964,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_math=yes + glibcxx_cv_c99_math=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_math=no +glibcxx_cv_c99_math=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -15681,12 +16030,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_math=yes + glibcxx_cv_c99_math=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_math=no +glibcxx_cv_c99_math=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -15694,9 +16043,9 @@ fi fi - echo "$as_me:$LINENO: result: $ac_c99_math" >&5 -echo "${ECHO_T}$ac_c99_math" >&6 - if test x"$ac_c99_math" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_math" >&6 + if test x"$glibcxx_cv_c99_math" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_MATH 1 @@ -16012,7 +16361,7 @@ fi done - ac_c99_complex=no; + glibcxx_cv_c99_complex=no; if test x"$ac_has_complex_h" = x"yes"; then echo "$as_me:$LINENO: checking for ISO C99 support in <complex.h>" >&5 echo $ECHO_N "checking for ISO C99 support in <complex.h>... $ECHO_C" >&6 @@ -16099,12 +16448,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_complex=yes + glibcxx_cv_c99_complex=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_complex=no +glibcxx_cv_c99_complex=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16195,20 +16544,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_complex=yes + glibcxx_cv_c99_complex=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_complex=no +glibcxx_cv_c99_complex=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi fi - echo "$as_me:$LINENO: result: $ac_c99_complex" >&5 -echo "${ECHO_T}$ac_c99_complex" >&6 - if test x"$ac_c99_complex" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_complex" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_complex" >&6 + if test x"$glibcxx_cv_c99_complex" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_COMPLEX 1 @@ -16219,7 +16568,7 @@ _ACEOF # Check for the existence in <stdio.h> of vscanf, et. al. echo "$as_me:$LINENO: checking for ISO C99 support in <stdio.h>" >&5 echo $ECHO_N "checking for ISO C99 support in <stdio.h>... $ECHO_C" >&6 - if test "${ac_c99_stdio+set}" = set; then + if test "${glibcxx_cv_c99_stdio+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -16270,12 +16619,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdio=yes + glibcxx_cv_c99_stdio=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdio=no +glibcxx_cv_c99_stdio=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16330,12 +16679,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdio=yes + glibcxx_cv_c99_stdio=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdio=no +glibcxx_cv_c99_stdio=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -16343,13 +16692,13 @@ fi fi - echo "$as_me:$LINENO: result: $ac_c99_stdio" >&5 -echo "${ECHO_T}$ac_c99_stdio" >&6 + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdio" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_stdio" >&6 # Check for the existence in <stdlib.h> of lldiv_t, et. al. echo "$as_me:$LINENO: checking for ISO C99 support in <stdlib.h>" >&5 echo $ECHO_N "checking for ISO C99 support in <stdlib.h>... $ECHO_C" >&6 - if test "${ac_c99_stdlib+set}" = set; then + if test "${glibcxx_cv_c99_stdlib+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -16406,12 +16755,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdlib=yes + glibcxx_cv_c99_stdlib=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdlib=no +glibcxx_cv_c99_stdlib=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else @@ -16472,12 +16821,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdlib=yes + glibcxx_cv_c99_stdlib=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdlib=no +glibcxx_cv_c99_stdlib=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -16485,11 +16834,11 @@ fi fi - echo "$as_me:$LINENO: result: $ac_c99_stdlib" >&5 -echo "${ECHO_T}$ac_c99_stdlib" >&6 + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdlib" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_stdlib" >&6 # Check for the existence in <wchar.h> of wcstold, etc. - ac_c99_wchar=no; + glibcxx_cv_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 @@ -16538,12 +16887,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_wchar=yes + glibcxx_cv_c99_wchar=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_wchar=no +glibcxx_cv_c99_wchar=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext @@ -16800,16 +17149,16 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - echo "$as_me:$LINENO: result: $ac_c99_wchar" >&5 -echo "${ECHO_T}$ac_c99_wchar" >&6 + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_wchar" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_wchar" >&6 fi # Option parsed, now set things appropriately. - if test x"$ac_c99_math" = x"no" || - test x"$ac_c99_complex" = x"no" || - test x"$ac_c99_stdio" = x"no" || - test x"$ac_c99_stdlib" = x"no" || - test x"$ac_c99_wchar" = x"no"; then + if test x"$glibcxx_cv_c99_math" = x"no" || + test x"$glibcxx_cv_c99_complex" = x"no" || + test x"$glibcxx_cv_c99_stdio" = x"no" || + test x"$glibcxx_cv_c99_stdlib" = x"no" || + test x"$glibcxx_cv_c99_wchar" = x"no"; then enable_c99=no; else @@ -16906,23 +17255,37 @@ echo "${ECHO_T}$enable_libstdcxx_debug" >&6 - # NB: libstdc++ may be configured before libgomp: can't check for the actual - # dependencies (omp.h and libgomp). enable_parallel=no; - if test -f $glibcxx_builddir/../libgomp/omp.h; then - enable_parallel=yes; - else - { echo "$as_me:$LINENO: $glibcxx_builddir/../libgomp/omp.h not found" >&5 -echo "$as_me: $glibcxx_builddir/../libgomp/omp.h not found" >&6;} - fi - # Check to see if it's explicitly disabled. -# GLIBCXX_ENABLE(libgomp,,,[enable code depending on libgomp], -# [permit yes|no]) + # Check to see if threads are disabled. + # Requires GLIBCXX_ENABLE_THREADS. + if test x$enable_thread = xyes; then -# if test x$enable_libgomp = xno; then -# enable_parallel=no -# fi + # Check to see if OpenMP is disabled. + echo "$as_me:$LINENO: checking for libgomp support" >&5 +echo $ECHO_N "checking for libgomp support... $ECHO_C" >&6 + # Check whether --enable-libgomp or --disable-libgomp was given. +if test "${enable_libgomp+set}" = set; then + enableval="$enable_libgomp" + + case "$enableval" in + yes|no) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable libgomp" >&5 +echo "$as_me: error: Unknown argument to enable/disable libgomp" >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + enable_libgomp=yes +fi; + + echo "$as_me:$LINENO: result: $enable_libgomp" >&5 +echo "${ECHO_T}$enable_libgomp" >&6 + if test x$enable_libgomp = xyes; then + enable_parallel=yes + fi + + fi echo "$as_me:$LINENO: checking for parallel mode support" >&5 echo $ECHO_N "checking for parallel mode support... $ECHO_C" >&6 @@ -16995,13 +17358,13 @@ _ACEOF # Checks for operating systems support that don't require linking. - echo "$as_me:$LINENO: checking for EOWNERDEAD" >&5 +echo "$as_me:$LINENO: checking for EOWNERDEAD" >&5 echo $ECHO_N "checking for EOWNERDEAD... $ECHO_C" >&6 - if test "${ac_system_error1+set}" = set; then +if test "${glibcxx_cv_system_error1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17011,7 +17374,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = EOWNERDEAD; +int i = EOWNERDEAD; ; return 0; } @@ -17038,34 +17401,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error1=yes + glibcxx_cv_system_error1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error1=no +glibcxx_cv_system_error1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error1" >&5 -echo "${ECHO_T}$ac_system_error1" >&6 - if test x"$ac_system_error1" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error1" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error1" >&6 +if test x"$glibcxx_cv_system_error1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_EOWNERDEAD 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENOTRECOVERABLE" >&5 +fi +echo "$as_me:$LINENO: checking for ENOTRECOVERABLE" >&5 echo $ECHO_N "checking for ENOTRECOVERABLE... $ECHO_C" >&6 - if test "${ac_system_error2+set}" = set; then +if test "${glibcxx_cv_system_error2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17075,7 +17437,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENOTRECOVERABLE; +int i = ENOTRECOVERABLE; ; return 0; } @@ -17102,34 +17464,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error2=yes + glibcxx_cv_system_error2=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error2=no +glibcxx_cv_system_error2=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error2" >&5 -echo "${ECHO_T}$ac_system_error2" >&6 - if test x"$ac_system_error2" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error2" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error2" >&6 +if test x"$glibcxx_cv_system_error2" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENOTRECOVERABLE 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENOLINK" >&5 +fi +echo "$as_me:$LINENO: checking for ENOLINK" >&5 echo $ECHO_N "checking for ENOLINK... $ECHO_C" >&6 - if test "${ac_system_error3+set}" = set; then +if test "${glibcxx_cv_system_error3+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17139,7 +17500,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENOLINK; +int i = ENOLINK; ; return 0; } @@ -17166,34 +17527,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error3=yes + glibcxx_cv_system_error3=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error3=no +glibcxx_cv_system_error3=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error3" >&5 -echo "${ECHO_T}$ac_system_error3" >&6 - if test x"$ac_system_error3" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error3" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error3" >&6 +if test x"$glibcxx_cv_system_error3" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENOLINK 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for EPROTO" >&5 +fi +echo "$as_me:$LINENO: checking for EPROTO" >&5 echo $ECHO_N "checking for EPROTO... $ECHO_C" >&6 - if test "${ac_system_error_4+set}" = set; then +if test "${glibcxx_cv_system_error4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17203,7 +17563,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = EPROTO; +int i = EPROTO; ; return 0; } @@ -17230,34 +17590,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_4=yes + glibcxx_cv_system_error4=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_4=no +glibcxx_cv_system_error4=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_4" >&5 -echo "${ECHO_T}$ac_system_error_4" >&6 - if test x"$ac_system_error_4" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error4" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error4" >&6 +if test x"$glibcxx_cv_system_error4" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_EPROTO 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENODATA" >&5 +fi +echo "$as_me:$LINENO: checking for ENODATA" >&5 echo $ECHO_N "checking for ENODATA... $ECHO_C" >&6 - if test "${ac_system_error_5+set}" = set; then +if test "${glibcxx_cv_system_error5+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17267,7 +17626,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENODATA; +int i = ENODATA; ; return 0; } @@ -17294,34 +17653,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_5=yes + glibcxx_cv_system_error5=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_5=no +glibcxx_cv_system_error5=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_5" >&5 -echo "${ECHO_T}$ac_system_error_5" >&6 - if test x"$ac_system_error_5" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error5" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error5" >&6 +if test x"$glibcxx_cv_system_error5" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENODATA 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENOSR" >&5 +fi +echo "$as_me:$LINENO: checking for ENOSR" >&5 echo $ECHO_N "checking for ENOSR... $ECHO_C" >&6 - if test "${ac_system_error_6+set}" = set; then +if test "${glibcxx_cv_system_error6+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17331,7 +17689,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENOSR; +int i = ENOSR; ; return 0; } @@ -17358,34 +17716,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_6=yes + glibcxx_cv_system_error6=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_6=no +glibcxx_cv_system_error6=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_6" >&5 -echo "${ECHO_T}$ac_system_error_6" >&6 - if test x"$ac_system_error_6" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error6" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error6" >&6 +if test x"$glibcxx_cv_system_error6" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENOSR 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENOSTR" >&5 +fi +echo "$as_me:$LINENO: checking for ENOSTR" >&5 echo $ECHO_N "checking for ENOSTR... $ECHO_C" >&6 - if test "${ac_system_error_7+set}" = set; then +if test "${glibcxx_cv_system_error7+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17395,7 +17752,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENOSTR; +int i = ENOSTR; ; return 0; } @@ -17422,34 +17779,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_7=yes + glibcxx_cv_system_error7=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_7=no +glibcxx_cv_system_error7=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_7" >&5 -echo "${ECHO_T}$ac_system_error_7" >&6 - if test x"$ac_system_error_7" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error7" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error7" >&6 +if test x"$glibcxx_cv_system_error7" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENOSTR 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ETIME" >&5 +fi +echo "$as_me:$LINENO: checking for ETIME" >&5 echo $ECHO_N "checking for ETIME... $ECHO_C" >&6 - if test "${ac_system_error_8+set}" = set; then +if test "${glibcxx_cv_system_error8+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17459,7 +17815,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ETIME; +int i = ETIME; ; return 0; } @@ -17486,34 +17842,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_8=yes + glibcxx_cv_system_error8=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_8=no +glibcxx_cv_system_error8=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_8" >&5 -echo "${ECHO_T}$ac_system_error_8" >&6 - if test x"$ac_system_error_8" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error8" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error8" >&6 +if test x"$glibcxx_cv_system_error8" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ETIME 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for sys_nerr" >&5 +fi +echo "$as_me:$LINENO: checking for sys_nerr" >&5 echo $ECHO_N "checking for sys_nerr... $ECHO_C" >&6 - if test "${ac_system_error9+set}" = set; then +if test "${glibcxx_cv_system_error9+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17523,7 +17878,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = sys_nerr; +int i = sys_nerr; ; return 0; } @@ -17550,34 +17905,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error9=yes + glibcxx_cv_system_error9=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error9=no +glibcxx_cv_system_error9=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error9" >&5 -echo "${ECHO_T}$ac_system_error9" >&6 - if test x"$ac_system_error9" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error9" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error9" >&6 +if test x"$glibcxx_cv_system_error9" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_NERR 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for EBADMSG" >&5 +fi +echo "$as_me:$LINENO: checking for EBADMSG" >&5 echo $ECHO_N "checking for EBADMSG... $ECHO_C" >&6 - if test "${ac_system_error_10+set}" = set; then +if test "${glibcxx_cv_system_error10+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17587,7 +17941,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = EBADMSG; +int i = EBADMSG; ; return 0; } @@ -17614,34 +17968,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_10=yes + glibcxx_cv_system_error10=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_10=no +glibcxx_cv_system_error10=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_10" >&5 -echo "${ECHO_T}$ac_system_error_10" >&6 - if test x"$ac_system_error_10" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error10" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error10" >&6 +if test x"$glibcxx_cv_system_error10" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_EBADMSG 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ECANCELED" >&5 +fi +echo "$as_me:$LINENO: checking for ECANCELED" >&5 echo $ECHO_N "checking for ECANCELED... $ECHO_C" >&6 - if test "${ac_system_error_11+set}" = set; then +if test "${glibcxx_cv_system_error11+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17651,7 +18004,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ECANCELED; +int i = ECANCELED; ; return 0; } @@ -17678,34 +18031,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_11=yes + glibcxx_cv_system_error11=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_11=no +glibcxx_cv_system_error11=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_11" >&5 -echo "${ECHO_T}$ac_system_error_11" >&6 - if test x"$ac_system_error_11" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error11" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error11" >&6 +if test x"$glibcxx_cv_system_error11" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ECANCELED 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for EOVERFLOW" >&5 +fi +echo "$as_me:$LINENO: checking for EOVERFLOW" >&5 echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6 - if test "${ac_system_error_12+set}" = set; then +if test "${glibcxx_cv_system_error12+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17715,7 +18067,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = EOVERFLOW; +int i = EOVERFLOW; ; return 0; } @@ -17742,34 +18094,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_12=yes + glibcxx_cv_system_error12=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_12=no +glibcxx_cv_system_error12=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_12" >&5 -echo "${ECHO_T}$ac_system_error_12" >&6 - if test x"$ac_system_error_12" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error12" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error12" >&6 +if test x"$glibcxx_cv_system_error12" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_EOVERFLOW 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ENOTSUP" >&5 +fi +echo "$as_me:$LINENO: checking for ENOTSUP" >&5 echo $ECHO_N "checking for ENOTSUP... $ECHO_C" >&6 - if test "${ac_system_error_13+set}" = set; then +if test "${glibcxx_cv_system_error13+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17779,7 +18130,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ENOTSUP; +int i = ENOTSUP; ; return 0; } @@ -17806,34 +18157,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_13=yes + glibcxx_cv_system_error13=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_13=no +glibcxx_cv_system_error13=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_13" >&5 -echo "${ECHO_T}$ac_system_error_13" >&6 - if test x"$ac_system_error_13" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error13" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error13" >&6 +if test x"$glibcxx_cv_system_error13" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ENOTSUP 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for EIDRM" >&5 +fi +echo "$as_me:$LINENO: checking for EIDRM" >&5 echo $ECHO_N "checking for EIDRM... $ECHO_C" >&6 - if test "${ac_system_error_14+set}" = set; then +if test "${glibcxx_cv_system_error14+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17843,7 +18193,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = EIDRM; +int i = EIDRM; ; return 0; } @@ -17870,34 +18220,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_14=yes + glibcxx_cv_system_error14=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_14=no +glibcxx_cv_system_error14=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_14" >&5 -echo "${ECHO_T}$ac_system_error_14" >&6 - if test x"$ac_system_error_14" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error14" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error14" >&6 +if test x"$glibcxx_cv_system_error14" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_EIDRM 1 _ACEOF - fi - - echo "$as_me:$LINENO: checking for ETXTBSY" >&5 +fi +echo "$as_me:$LINENO: checking for ETXTBSY" >&5 echo $ECHO_N "checking for ETXTBSY... $ECHO_C" >&6 - if test "${ac_system_error_15+set}" = set; then +if test "${glibcxx_cv_system_error15+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17907,7 +18256,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { - int i = ETXTBSY; +int i = ETXTBSY; ; return 0; } @@ -17934,328 +18283,31 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_system_error_15=yes + glibcxx_cv_system_error15=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_system_error_15=no +glibcxx_cv_system_error15=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_system_error_15" >&5 -echo "${ECHO_T}$ac_system_error_15" >&6 - if test x"$ac_system_error_15" = x"yes"; then +echo "$as_me:$LINENO: result: $glibcxx_cv_system_error15" >&5 +echo "${ECHO_T}$glibcxx_cv_system_error15" >&6 +if test x"$glibcxx_cv_system_error15" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_ETXTBSY 1 _ACEOF - fi - - - - echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5 -echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6 - if test "${ac_standard_layout+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - 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 - - ac_test_CXXFLAGS="${CXXFLAGS+set}" - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS='-std=gnu++0x' - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -struct b - { - bool t; - - // Need standard layout relaxation from POD - private: - b& operator=(const b&); - b(const b&); - }; - - int main() - { - b tst1 = { false }; - return 0; - } -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 - ac_standard_layout=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_standard_layout=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - - CXXFLAGS="$ac_save_CXXFLAGS" - 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 - - echo "$as_me:$LINENO: result: $ac_standard_layout" >&5 -echo "${ECHO_T}$ac_standard_layout" >&6 - if test x"$ac_standard_layout" = x"yes"; then - -cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_USE_STANDARD_LAYOUT 1 -_ACEOF - - fi - - -# No surprises, no surprises... - - echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 -echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` - echo "$as_me:$LINENO: result: $target_thread_file" >&5 -echo "${ECHO_T}$target_thread_file" >&6 - - if test $target_thread_file != single; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GTHR_DEFAULT 1 -_ACEOF - - fi - - glibcxx_thread_h=gthr-$target_thread_file.h - - gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} - if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then - enable_thread=yes - else - enable_thread=no - fi - - - - - echo "$as_me:$LINENO: checking for atomic builtins" >&5 -echo $ECHO_N "checking for atomic builtins... $ECHO_C" >&6 - - - 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 - - - # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. - cat > conftest.$ac_ext << EOF -#line 18100 "configure" -int main() -{ - // NB: _Atomic_word not necessarily int. - typedef int atomic_type; - atomic_type c1; - atomic_type c2; - const atomic_type c3(0); - if (__sync_fetch_and_add(&c1, c2) == c3) - { - // Do something. - } - return 0; -} -EOF - old_CXXFLAGS="$CXXFLAGS" - CXXFLAGS='-O0 -S' - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep __sync_fetch_and_add conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtins=no - else - -cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_ATOMIC_BUILTINS 1 -_ACEOF - - enable_atomic_builtins=yes - atomicity_dir=cpu/generic/atomicity_builtins - fi - fi - echo "$as_me:$LINENO: result: $enable_atomic_builtins" >&5 -echo "${ECHO_T}$enable_atomic_builtins" >&6 - CXXFLAGS="$old_CXXFLAGS" - rm -f conftest* - - # Now, if still generic, set to mutex. - if test $atomicity_dir = "cpu/generic" ; then - atomicity_dir=cpu/generic/atomicity_mutex - 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 - - -if test $atomicity_dir = cpu/generic/atomicity_mutex ; then - { echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5 -echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;} - if test $target_thread_file = single; then - { echo "$as_me:$LINENO: WARNING: They cannot be faked when thread support is disabled." >&5 -echo "$as_me: WARNING: They cannot be faked when thread support is disabled." >&2;} - { echo "$as_me:$LINENO: WARNING: Thread-safety of certain classes is not guaranteed." >&5 -echo "$as_me: WARNING: Thread-safety of certain classes is not guaranteed." >&2;} - else - { echo "$as_me:$LINENO: WARNING: They will be faked using a mutex." >&5 -echo "$as_me: WARNING: They will be faked using a mutex." >&2;} - { echo "$as_me:$LINENO: WARNING: Performance of certain classes will degrade as a result." >&5 -echo "$as_me: WARNING: Performance of certain classes will degrade as a result." >&2;} - fi -fi - - - # All these tests are for C++; save the language and the compiler flags. - # The CXXFLAGS thing is suspicious, but based on similar bits previously - # found in GLIBCXX_CONFIGURE. - - - 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 - - ac_test_CXXFLAGS="${CXXFLAGS+set}" - ac_save_CXXFLAGS="$CXXFLAGS" - - # Check for maintainer-mode bits. - if test x"$USE_MAINTAINER_MODE" = xno; then - WERROR='' - else - WERROR='-Werror' - fi - - # Check for -ffunction-sections -fdata-sections - echo "$as_me:$LINENO: checking for g++ that supports -ffunction-sections -fdata-sections" >&5 -echo $ECHO_N "checking for g++ that supports -ffunction-sections -fdata-sections... $ECHO_C" >&6 - CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int foo; void bar() { }; -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 - ac_fdsections=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_fdsections=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" - else - # this is the suspicious part - CXXFLAGS='' - fi - if test x"$ac_fdsections" = x"yes"; then - SECTION_FLAGS='-ffunction-sections -fdata-sections' - fi - echo "$as_me:$LINENO: result: $ac_fdsections" >&5 -echo "${ECHO_T}$ac_fdsections" >&6 - - 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 - +# Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then # We can do more elaborate tests that assume a working linker. @@ -40102,7 +40154,7 @@ _ACEOF # Check for the existence of <ctype.h> functions. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6 - if test "${ac_c99_ctype_tr1+set}" = set; then + if test "${glibcxx_cv_c99_ctype_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -40146,20 +40198,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_ctype_tr1=yes + glibcxx_cv_c99_ctype_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_ctype_tr1=no +glibcxx_cv_c99_ctype_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_ctype_tr1" >&5 -echo "${ECHO_T}$ac_c99_ctype_tr1" >&6 - if test x"$ac_c99_ctype_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_ctype_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_ctype_tr1" >&6 + if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_CTYPE_TR1 1 @@ -40398,7 +40450,7 @@ _ACEOF # Check for the existence of <stdint.h> types. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6 - if test "${ac_c99_stdint_tr1+set}" = set; then + if test "${glibcxx_cv_c99_stdint_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -40467,20 +40519,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdint_tr1=yes + glibcxx_cv_c99_stdint_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdint_tr1=no +glibcxx_cv_c99_stdint_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_stdint_tr1" >&5 -echo "${ECHO_T}$ac_c99_stdint_tr1" >&6 - if test x"$ac_c99_stdint_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdint_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_stdint_tr1" >&6 + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_STDINT_TR1 1 @@ -40491,7 +40543,7 @@ _ACEOF # Check for the existence of <math.h> functions. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6 - if test "${ac_c99_math_tr1+set}" = set; then + if test "${glibcxx_cv_c99_math_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -40639,20 +40691,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_math_tr1=yes + glibcxx_cv_c99_math_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_math_tr1=no +glibcxx_cv_c99_math_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_math_tr1" >&5 -echo "${ECHO_T}$ac_c99_math_tr1" >&6 - if test x"$ac_c99_math_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_math_tr1" >&6 + if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_MATH_TR1 1 @@ -40663,7 +40715,7 @@ _ACEOF # Check for the existence of <inttypes.h> functions (NB: doesn't make # sense if the previous check fails, per C99, 7.8/1). ac_c99_inttypes_tr1=no; - if test x"$ac_c99_stdint_tr1" = x"yes"; then + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF @@ -40895,12 +40947,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device" >&5 echo $ECHO_N "checking for \"dev/random\" and \"dev/urandom\" for TR1 random_device... $ECHO_C" >&6 - if test "${ac_random_tr1+set}" = set; then + if test "${glibcxx_cv_random_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - ac_random_tr1=no + glibcxx_cv_random_tr1=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -40927,23 +40979,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_random_tr1=yes + glibcxx_cv_random_tr1=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -ac_random_tr1=no +glibcxx_cv_random_tr1=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - echo "$as_me:$LINENO: result: $ac_random_tr1" >&5 -echo "${ECHO_T}$ac_random_tr1" >&6 - if test x"$ac_random_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_random_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_random_tr1" >&6 + if test x"$glibcxx_cv_random_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_RANDOM_TR1 1 @@ -109211,7 +109263,7 @@ _ACEOF # Check for the existence of <ctype.h> functions. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6 - if test "${ac_c99_ctype_tr1+set}" = set; then + if test "${glibcxx_cv_c99_ctype_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -109255,20 +109307,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_ctype_tr1=yes + glibcxx_cv_c99_ctype_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_ctype_tr1=no +glibcxx_cv_c99_ctype_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_ctype_tr1" >&5 -echo "${ECHO_T}$ac_c99_ctype_tr1" >&6 - if test x"$ac_c99_ctype_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_ctype_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_ctype_tr1" >&6 + if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_CTYPE_TR1 1 @@ -109507,7 +109559,7 @@ _ACEOF # Check for the existence of <stdint.h> types. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6 - if test "${ac_c99_stdint_tr1+set}" = set; then + if test "${glibcxx_cv_c99_stdint_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -109576,20 +109628,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_stdint_tr1=yes + glibcxx_cv_c99_stdint_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_stdint_tr1=no +glibcxx_cv_c99_stdint_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_stdint_tr1" >&5 -echo "${ECHO_T}$ac_c99_stdint_tr1" >&6 - if test x"$ac_c99_stdint_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_stdint_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_stdint_tr1" >&6 + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_STDINT_TR1 1 @@ -109600,7 +109652,7 @@ _ACEOF # Check for the existence of <math.h> functions. echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6 - if test "${ac_c99_math_tr1+set}" = set; then + if test "${glibcxx_cv_c99_math_tr1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -109748,20 +109800,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_c99_math_tr1=yes + glibcxx_cv_c99_math_tr1=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_c99_math_tr1=no +glibcxx_cv_c99_math_tr1=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: result: $ac_c99_math_tr1" >&5 -echo "${ECHO_T}$ac_c99_math_tr1" >&6 - if test x"$ac_c99_math_tr1" = x"yes"; then + echo "$as_me:$LINENO: result: $glibcxx_cv_c99_math_tr1" >&5 +echo "${ECHO_T}$glibcxx_cv_c99_math_tr1" >&6 + if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_USE_C99_MATH_TR1 1 @@ -109772,7 +109824,7 @@ _ACEOF # Check for the existence of <inttypes.h> functions (NB: doesn't make # sense if the previous check fails, per C99, 7.8/1). ac_c99_inttypes_tr1=no; - if test x"$ac_c99_stdint_tr1" = x"yes"; then + if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5 echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF @@ -119151,7 +119203,7 @@ fi; if test x$enable_visibility = xyes ; then echo "$as_me:$LINENO: checking whether the target supports hidden visibility" >&5 echo $ECHO_N "checking whether the target supports hidden visibility... $ECHO_C" >&6 -if test "${have_attribute_visibility+set}" = set; then +if test "${glibcxx_cv_have_attribute_visibility+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -119194,19 +119246,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_attribute_visibility=yes + glibcxx_cv_have_attribute_visibility=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -have_attribute_visibility=no +glibcxx_cv_have_attribute_visibility=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" fi -echo "$as_me:$LINENO: result: $have_attribute_visibility" >&5 -echo "${ECHO_T}$have_attribute_visibility" >&6 - if test $have_attribute_visibility = no; then +echo "$as_me:$LINENO: result: $glibcxx_cv_have_attribute_visibility" >&5 +echo "${ECHO_T}$glibcxx_cv_have_attribute_visibility" >&6 + if test $glibcxx_cv_have_attribute_visibility = no; then enable_visibility=no fi fi @@ -119749,7 +119801,7 @@ echo "${ECHO_T}$res" >&6 # Check for rlimit, setrlimit. - if test "${ac_setrlimit+set}" = set; then + if test "${glibcxx_cv_setrlimit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -119794,12 +119846,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_setrlimit=yes + glibcxx_cv_setrlimit=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_setrlimit=no +glibcxx_cv_setrlimit=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext @@ -119809,7 +119861,7 @@ fi echo "$as_me:$LINENO: checking for testsuite resource limits support" >&5 echo $ECHO_N "checking for testsuite resource limits support... $ECHO_C" >&6 - if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then + if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then ac_res_limits=yes cat >>confdefs.h <<\_ACEOF @@ -121612,6 +121664,9 @@ s,@GLIBCXX_HOSTED_FALSE@,$GLIBCXX_HOSTED_FALSE,;t t s,@GLIBCXX_BUILD_PCH_TRUE@,$GLIBCXX_BUILD_PCH_TRUE,;t t s,@GLIBCXX_BUILD_PCH_FALSE@,$GLIBCXX_BUILD_PCH_FALSE,;t t s,@glibcxx_PCHFLAGS@,$glibcxx_PCHFLAGS,;t t +s,@glibcxx_thread_h@,$glibcxx_thread_h,;t t +s,@WERROR@,$WERROR,;t t +s,@SECTION_FLAGS@,$SECTION_FLAGS,;t t s,@CSTDIO_H@,$CSTDIO_H,;t t s,@BASIC_FILE_H@,$BASIC_FILE_H,;t t s,@BASIC_FILE_CC@,$BASIC_FILE_CC,;t t @@ -121651,9 +121706,6 @@ s,@GLIBCXX_BUILD_DEBUG_FALSE@,$GLIBCXX_BUILD_DEBUG_FALSE,;t t s,@ENABLE_PARALLEL_TRUE@,$ENABLE_PARALLEL_TRUE,;t t s,@ENABLE_PARALLEL_FALSE@,$ENABLE_PARALLEL_FALSE,;t t s,@EXTRA_CXX_FLAGS@,$EXTRA_CXX_FLAGS,;t t -s,@glibcxx_thread_h@,$glibcxx_thread_h,;t t -s,@WERROR@,$WERROR,;t t -s,@SECTION_FLAGS@,$SECTION_FLAGS,;t t s,@SECTION_LDFLAGS@,$SECTION_LDFLAGS,;t t s,@OPT_LDFLAGS@,$OPT_LDFLAGS,;t t s,@LIBMATHOBJS@,$LIBMATHOBJS,;t t diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 366e443ef7b..7279b118923 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -95,6 +95,12 @@ GLIBCXX_ENABLE_HOSTED # Enable compiler support that doesn't require linking. GLIBCXX_ENABLE_SJLJ_EXCEPTIONS GLIBCXX_ENABLE_PCH($is_hosted) +GLIBCXX_ENABLE_ATOMIC_BUILTINS +GLIBCXX_ENABLE_THREADS + +# Checks for compiler support that don't require linking. +GLIBCXX_CHECK_COMPILER_FEATURES +GLIBCXX_CHECK_STANDARD_LAYOUT # Enable all the variable C++ runtime options that doesn't require linking. GLIBCXX_ENABLE_CSTDIO @@ -107,30 +113,15 @@ GLIBCXX_ENABLE_C99([yes]) GLIBCXX_ENABLE_CONCEPT_CHECKS([no]) GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0"]) GLIBCXX_ENABLE_DEBUG([no]) -GLIBCXX_ENABLE_PARALLEL +GLIBCXX_ENABLE_PARALLEL([yes]) GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) # Checks for operating systems support that don't require linking. GLIBCXX_CHECK_SYSTEM_ERROR -GLIBCXX_CHECK_STANDARD_LAYOUT -# No surprises, no surprises... -GLIBCXX_ENABLE_THREADS -GLIBCXX_ENABLE_ATOMIC_BUILTINS -if test $atomicity_dir = cpu/generic/atomicity_mutex ; then - AC_MSG_WARN([No native atomic operations are provided for this platform.]) - if test $target_thread_file = single; then - AC_MSG_WARN([They cannot be faked when thread support is disabled.]) - AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.]) - else - AC_MSG_WARN([They will be faked using a mutex.]) - AC_MSG_WARN([Performance of certain classes will degrade as a result.]) - fi -fi - -GLIBCXX_CHECK_COMPILER_FEATURES +# Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then # We can do more elaborate tests that assume a working linker. diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index 54bdda01918..dc02af2cd5f 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/doc/xml/manual/concurrency.xml b/libstdc++-v3/doc/xml/manual/concurrency.xml index b21d458e96c..7efc2956858 100644 --- a/libstdc++-v3/doc/xml/manual/concurrency.xml +++ b/libstdc++-v3/doc/xml/manual/concurrency.xml @@ -214,8 +214,11 @@ usage vary depending on the target hardware and the flags used during compile. </para> -<para> If builtins are possible, <code>_GLIBCXX_ATOMIC_BUILTINS</code> -will be defined. +<para> +If builtins are possible for bool-sized integral types, +<code>_GLIBCXX_ATOMIC_BUILTINS_1</code> will be defined. +If builtins are possible for int-sized integral types, +<code>_GLIBCXX_ATOMIC_BUILTINS_4</code> will be defined. </para> diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 0d002273c57..22ac39c436b 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -706,6 +706,7 @@ debug_headers = \ # Parallel mode headers parallel_srcdir = ${glibcxx_srcdir}/include/parallel parallel_builddir = ./parallel +if ENABLE_PARALLEL parallel_headers = \ ${parallel_srcdir}/algorithm \ ${parallel_srcdir}/algobase.h \ @@ -751,6 +752,9 @@ parallel_headers = \ ${parallel_srcdir}/types.h \ ${parallel_srcdir}/unique_copy.h \ ${parallel_srcdir}/workstealing.h +else +parallel_headers = +endif # Some of the different "C" header models need extra files. @@ -858,72 +862,46 @@ allcreated = \ # Here are the rules for building the headers all-local: ${allstamped} ${allcreated} -# This rule is slightly different, in that we must change the name of the -# local file from std_foo.h to foo. +# Ignore errors from 'mkdir -p' to avoid parallel make failure on +# systems with broken mkdir. Call mkdir unconditionally because +# it is just as cheap to avoid going through the shell. +# Ignore errors from $(LN_S) because the links may already exist. stamp-std: ${std_headers} - @if [ ! -d "${std_builddir}" ]; then \ - mkdir -p ${std_builddir} ;\ - fi ;\ - if [ ! -f stamp-std ]; then \ - (cd ${std_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-std + @-mkdir -p ${std_builddir} + @-cd ${std_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-std stamp-bits: ${bits_headers} - @if [ ! -d "${bits_builddir}" ]; then \ - mkdir -p ${bits_builddir} ;\ - fi ;\ - if [ ! -f stamp-bits ]; then \ - (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-bits - -stamp-c_base: ${c_base_headers} - @if [ ! -d "${c_base_builddir}" ]; then \ - mkdir -p ${c_base_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_base ]; then \ - (cd ${c_base_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-c_base + @-mkdir -p ${bits_builddir} + @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-bits + +stamp-c_base: ${c_base_headers} + @-mkdir -p ${c_base_builddir} + @-cd ${c_base_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-c_base stamp-c_base_extra: ${c_base_headers_extra} - @if [ ! -d "${bits_builddir}" ]; then \ - mkdir -p ${bits_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_base_extra ]; then \ - (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-c_base_extra + @-mkdir -p ${bits_builddir} + @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-c_base_extra stamp-c_compatibility: ${c_compatibility_headers_extra} - @if [ ! -d "${c_compatibility_builddir}" ]; then \ - mkdir -p ${c_compatibility_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_compatibility ]; then \ - if [ ! -z "${c_compatibility_headers_extra}" ]; then \ - (cd ${c_compatibility_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - fi ;\ - $(STAMP) stamp-c_compatibility + @-mkdir -p ${c_compatibility_builddir} + @-if [ ! -z "${c_compatibility_headers_extra}" ]; then \ + cd ${c_compatibility_builddir} && $(LN_S) $? . 2>/dev/null ;\ + fi + @$(STAMP) stamp-c_compatibility stamp-backward: ${backward_headers} - @if [ ! -d "${backward_builddir}" ]; then \ - mkdir -p ${backward_builddir} ;\ - fi ;\ - if [ ! -f stamp-backward ]; then \ - (cd ${backward_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-backward + @-mkdir -p ${backward_builddir} + @-cd ${backward_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-backward stamp-ext: ${ext_headers} - @if [ ! -d "${ext_builddir}" ]; then \ - mkdir -p ${ext_builddir} ;\ - fi ;\ - if [ ! -f stamp-ext ]; then \ - (cd ${ext_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-ext + @-mkdir -p ${ext_builddir} + @-cd ${ext_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-ext # Have to deal with nested include directories, gah! Strip off source # directory before making the link. @@ -977,52 +955,33 @@ stamp-pb: $(STAMP) stamp-pb stamp-tr1: ${tr1_headers} - @if [ ! -d "${tr1_builddir}" ]; then \ - mkdir -p ${tr1_builddir} ;\ - fi ;\ - if [ ! -f stamp-tr1 ]; then \ - (cd ${tr1_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-tr1 + @-mkdir -p ${tr1_builddir} + @-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-tr1 stamp-tr1-impl: ${tr1_impl_headers} - @if [ ! -d "${tr1_impl_builddir}" ]; then \ - mkdir -p ${tr1_impl_builddir} ;\ - fi ;\ - if [ ! -f stamp-tr1-impl ]; then \ - (cd ${tr1_impl_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-tr1-impl + @-mkdir -p ${tr1_impl_builddir} + @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-tr1-impl stamp-debug: ${debug_headers} - @if [ ! -d "${debug_builddir}" ]; then \ - mkdir -p ${debug_builddir} ;\ - fi ;\ - if [ ! -f stamp-debug ]; then \ - (cd ${debug_builddir} && @LN_S@ $? . || true) ;\ - fi ;\ - $(STAMP) stamp-debug + @-mkdir -p ${debug_builddir} + @-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-debug stamp-parallel: ${parallel_headers} - @if [ ! -d "${parallel_builddir}" ]; then \ - mkdir -p ${parallel_builddir} ;\ - fi ;\ - if [ ! -f stamp-parallel ]; then \ - (cd ${parallel_builddir} && @LN_S@ $? . || true) ;\ - fi ;\ - $(STAMP) stamp-parallel + @-mkdir -p ${parallel_builddir} + @-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-parallel stamp-${host_alias}: - @if [ ! -d ${host_builddir} ]; then \ - mkdir -p ${host_builddir} ;\ - fi ;\ - $(STAMP) stamp-${host_alias} + @-mkdir -p ${host_builddir} + @$(STAMP) stamp-${host_alias} # Host includes static. # XXX Missing dependency info for {host_headers_extra} stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias} - @if [ ! -f stamp-host ]; then \ - (cd ${host_builddir} ;\ + @cd ${host_builddir} && {\ $(LN_S) ${host_headers} . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_H) basic_file.h || true ;\ $(LN_S) ${glibcxx_srcdir}/$(ALLOCATOR_H) c++allocator.h || true ;\ @@ -1031,8 +990,8 @@ stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias} $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(COMPATIBILITY_H) . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_H) messages_members.h || true ;\ - $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true);\ - fi ;\ + $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true;\ + } 2>/dev/null $(STAMP) stamp-host # Host includes dynamic. @@ -1125,34 +1084,22 @@ ${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \ # Build two precompiled C++ includes, stdc++.h.gch/*.gch ${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source} - if [ ! -d "${pch1_output_builddir}" ]; then \ - mkdir -p ${pch1_output_builddir}; \ - fi; \ + -mkdir -p ${pch1_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@ - touch ${pch1_output_anchor} ${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source} - if [ ! -d "${pch1_output_builddir}" ]; then \ - mkdir -p ${pch1_output_builddir}; \ - fi; \ + -mkdir -p ${pch1_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@ - touch ${pch1_output_anchor} # Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch ${pch2_output}: ${pch2_source} ${pch1_output} - if [ ! -d "${pch2_output_builddir}" ]; then \ - mkdir -p ${pch2_output_builddir}; \ - fi; \ + -mkdir -p ${pch2_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@ - touch ${pch2_output_anchor} # Build a precompiled extension include, extc++.h.gch/O2.gch ${pch3_output}: ${pch3_source} ${pch2_output} - if [ ! -d "${pch3_output_builddir}" ]; then \ - mkdir -p ${pch3_output_builddir}; \ - fi; \ + -mkdir -p ${pch3_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@ - touch ${pch3_output_anchor} # For robustness sake (in light of junk files or in-source # configuration), copy from the build or source tree to the install diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 0ae30407cba..61fa83ec812 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ @@ -950,51 +951,52 @@ debug_headers = \ # Parallel mode headers parallel_srcdir = ${glibcxx_srcdir}/include/parallel parallel_builddir = ./parallel -parallel_headers = \ - ${parallel_srcdir}/algorithm \ - ${parallel_srcdir}/algobase.h \ - ${parallel_srcdir}/algo.h \ - ${parallel_srcdir}/algorithm \ - ${parallel_srcdir}/algorithmfwd.h \ - ${parallel_srcdir}/balanced_quicksort.h \ - ${parallel_srcdir}/base.h \ - ${parallel_srcdir}/basic_iterator.h \ - ${parallel_srcdir}/checkers.h \ - ${parallel_srcdir}/compatibility.h \ - ${parallel_srcdir}/compiletime_settings.h \ - ${parallel_srcdir}/equally_split.h \ - ${parallel_srcdir}/features.h \ - ${parallel_srcdir}/find.h \ - ${parallel_srcdir}/find_selectors.h \ - ${parallel_srcdir}/for_each.h \ - ${parallel_srcdir}/for_each_selectors.h \ - ${parallel_srcdir}/iterator.h \ - ${parallel_srcdir}/list_partition.h \ - ${parallel_srcdir}/losertree.h \ - ${parallel_srcdir}/merge.h \ - ${parallel_srcdir}/multiseq_selection.h \ - ${parallel_srcdir}/multiway_merge.h \ - ${parallel_srcdir}/multiway_mergesort.h \ - ${parallel_srcdir}/numeric \ - ${parallel_srcdir}/numericfwd.h \ - ${parallel_srcdir}/omp_loop.h \ - ${parallel_srcdir}/omp_loop_static.h \ - ${parallel_srcdir}/parallel.h \ - ${parallel_srcdir}/par_loop.h \ - ${parallel_srcdir}/partial_sum.h \ - ${parallel_srcdir}/partition.h \ - ${parallel_srcdir}/queue.h \ - ${parallel_srcdir}/quicksort.h \ - ${parallel_srcdir}/random_number.h \ - ${parallel_srcdir}/random_shuffle.h \ - ${parallel_srcdir}/search.h \ - ${parallel_srcdir}/set_operations.h \ - ${parallel_srcdir}/settings.h \ - ${parallel_srcdir}/sort.h \ - ${parallel_srcdir}/tags.h \ - ${parallel_srcdir}/types.h \ - ${parallel_srcdir}/unique_copy.h \ - ${parallel_srcdir}/workstealing.h +@ENABLE_PARALLEL_FALSE@parallel_headers = +@ENABLE_PARALLEL_TRUE@parallel_headers = \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithm \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algobase.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algo.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithm \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithmfwd.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/balanced_quicksort.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/base.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/basic_iterator.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/checkers.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/compatibility.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/compiletime_settings.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/equally_split.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/features.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/find.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/find_selectors.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/for_each.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/for_each_selectors.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/iterator.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/list_partition.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/losertree.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/merge.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiseq_selection.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiway_merge.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/multiway_mergesort.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/numeric \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/numericfwd.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop_static.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/parallel.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/par_loop.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partial_sum.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partition.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/queue.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/quicksort.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/random_number.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/random_shuffle.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/search.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/set_operations.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/settings.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/sort.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/tags.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/types.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/unique_copy.h \ +@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/workstealing.h @GLIBCXX_C_HEADERS_EXTRA_FALSE@c_base_headers_extra = @@ -1260,72 +1262,46 @@ uninstall-am: uninstall-info-am # Here are the rules for building the headers all-local: ${allstamped} ${allcreated} -# This rule is slightly different, in that we must change the name of the -# local file from std_foo.h to foo. +# Ignore errors from 'mkdir -p' to avoid parallel make failure on +# systems with broken mkdir. Call mkdir unconditionally because +# it is just as cheap to avoid going through the shell. +# Ignore errors from $(LN_S) because the links may already exist. stamp-std: ${std_headers} - @if [ ! -d "${std_builddir}" ]; then \ - mkdir -p ${std_builddir} ;\ - fi ;\ - if [ ! -f stamp-std ]; then \ - (cd ${std_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-std + @-mkdir -p ${std_builddir} + @-cd ${std_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-std stamp-bits: ${bits_headers} - @if [ ! -d "${bits_builddir}" ]; then \ - mkdir -p ${bits_builddir} ;\ - fi ;\ - if [ ! -f stamp-bits ]; then \ - (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-bits - -stamp-c_base: ${c_base_headers} - @if [ ! -d "${c_base_builddir}" ]; then \ - mkdir -p ${c_base_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_base ]; then \ - (cd ${c_base_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-c_base + @-mkdir -p ${bits_builddir} + @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-bits + +stamp-c_base: ${c_base_headers} + @-mkdir -p ${c_base_builddir} + @-cd ${c_base_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-c_base stamp-c_base_extra: ${c_base_headers_extra} - @if [ ! -d "${bits_builddir}" ]; then \ - mkdir -p ${bits_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_base_extra ]; then \ - (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-c_base_extra + @-mkdir -p ${bits_builddir} + @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-c_base_extra stamp-c_compatibility: ${c_compatibility_headers_extra} - @if [ ! -d "${c_compatibility_builddir}" ]; then \ - mkdir -p ${c_compatibility_builddir} ;\ - fi ;\ - if [ ! -f stamp-c_compatibility ]; then \ - if [ ! -z "${c_compatibility_headers_extra}" ]; then \ - (cd ${c_compatibility_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - fi ;\ - $(STAMP) stamp-c_compatibility + @-mkdir -p ${c_compatibility_builddir} + @-if [ ! -z "${c_compatibility_headers_extra}" ]; then \ + cd ${c_compatibility_builddir} && $(LN_S) $? . 2>/dev/null ;\ + fi + @$(STAMP) stamp-c_compatibility stamp-backward: ${backward_headers} - @if [ ! -d "${backward_builddir}" ]; then \ - mkdir -p ${backward_builddir} ;\ - fi ;\ - if [ ! -f stamp-backward ]; then \ - (cd ${backward_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-backward + @-mkdir -p ${backward_builddir} + @-cd ${backward_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-backward stamp-ext: ${ext_headers} - @if [ ! -d "${ext_builddir}" ]; then \ - mkdir -p ${ext_builddir} ;\ - fi ;\ - if [ ! -f stamp-ext ]; then \ - (cd ${ext_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-ext + @-mkdir -p ${ext_builddir} + @-cd ${ext_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-ext # Have to deal with nested include directories, gah! Strip off source # directory before making the link. @@ -1379,52 +1355,33 @@ stamp-pb: $(STAMP) stamp-pb stamp-tr1: ${tr1_headers} - @if [ ! -d "${tr1_builddir}" ]; then \ - mkdir -p ${tr1_builddir} ;\ - fi ;\ - if [ ! -f stamp-tr1 ]; then \ - (cd ${tr1_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-tr1 + @-mkdir -p ${tr1_builddir} + @-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-tr1 stamp-tr1-impl: ${tr1_impl_headers} - @if [ ! -d "${tr1_impl_builddir}" ]; then \ - mkdir -p ${tr1_impl_builddir} ;\ - fi ;\ - if [ ! -f stamp-tr1-impl ]; then \ - (cd ${tr1_impl_builddir} && $(LN_S) $? . || true) ;\ - fi ;\ - $(STAMP) stamp-tr1-impl + @-mkdir -p ${tr1_impl_builddir} + @-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-tr1-impl stamp-debug: ${debug_headers} - @if [ ! -d "${debug_builddir}" ]; then \ - mkdir -p ${debug_builddir} ;\ - fi ;\ - if [ ! -f stamp-debug ]; then \ - (cd ${debug_builddir} && @LN_S@ $? . || true) ;\ - fi ;\ - $(STAMP) stamp-debug + @-mkdir -p ${debug_builddir} + @-cd ${debug_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-debug stamp-parallel: ${parallel_headers} - @if [ ! -d "${parallel_builddir}" ]; then \ - mkdir -p ${parallel_builddir} ;\ - fi ;\ - if [ ! -f stamp-parallel ]; then \ - (cd ${parallel_builddir} && @LN_S@ $? . || true) ;\ - fi ;\ - $(STAMP) stamp-parallel + @-mkdir -p ${parallel_builddir} + @-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null + @$(STAMP) stamp-parallel stamp-${host_alias}: - @if [ ! -d ${host_builddir} ]; then \ - mkdir -p ${host_builddir} ;\ - fi ;\ - $(STAMP) stamp-${host_alias} + @-mkdir -p ${host_builddir} + @$(STAMP) stamp-${host_alias} # Host includes static. # XXX Missing dependency info for {host_headers_extra} stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias} - @if [ ! -f stamp-host ]; then \ - (cd ${host_builddir} ;\ + @cd ${host_builddir} && {\ $(LN_S) ${host_headers} . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_H) basic_file.h || true ;\ $(LN_S) ${glibcxx_srcdir}/$(ALLOCATOR_H) c++allocator.h || true ;\ @@ -1433,8 +1390,8 @@ stamp-host: ${host_headers} ${host_headers_noinst} stamp-${host_alias} $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_INTERNAL_H) . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(COMPATIBILITY_H) . || true ;\ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_H) messages_members.h || true ;\ - $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true);\ - fi ;\ + $(LN_S) ${glibcxx_srcdir}/$(CTIME_H) time_members.h || true;\ + } 2>/dev/null $(STAMP) stamp-host # Host includes dynamic. @@ -1518,34 +1475,22 @@ ${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \ # Build two precompiled C++ includes, stdc++.h.gch/*.gch ${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source} - if [ ! -d "${pch1_output_builddir}" ]; then \ - mkdir -p ${pch1_output_builddir}; \ - fi; \ + -mkdir -p ${pch1_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O0 -g ${pch1_source} -o $@ - touch ${pch1_output_anchor} ${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source} - if [ ! -d "${pch1_output_builddir}" ]; then \ - mkdir -p ${pch1_output_builddir}; \ - fi; \ + -mkdir -p ${pch1_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch1_source} -o $@ - touch ${pch1_output_anchor} # Build a precompiled TR1 include, stdtr1c++.h.gch/O2.gch ${pch2_output}: ${pch2_source} ${pch1_output} - if [ ! -d "${pch2_output_builddir}" ]; then \ - mkdir -p ${pch2_output_builddir}; \ - fi; \ + -mkdir -p ${pch2_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch2_source} -o $@ - touch ${pch2_output_anchor} # Build a precompiled extension include, extc++.h.gch/O2.gch ${pch3_output}: ${pch3_source} ${pch2_output} - if [ ! -d "${pch3_output_builddir}" ]; then \ - mkdir -p ${pch3_output_builddir}; \ - fi; \ + -mkdir -p ${pch3_output_builddir} $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@ - touch ${pch3_output_anchor} # For robustness sake (in light of junk files or in-source # configuration), copy from the build or source tree to the install diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list index b071d4fcdd6..d0797e9bf46 100644 --- a/libstdc++-v3/include/debug/list +++ b/libstdc++-v3/include/debug/list @@ -1,6 +1,6 @@ // Debugging list implementation -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -527,14 +527,19 @@ namespace __debug merge(list& __x) #endif { - __glibcxx_check_sorted(_Base::begin(), _Base::end()); - __glibcxx_check_sorted(__x.begin().base(), __x.end().base()); - for (iterator __tmp = __x.begin(); __tmp != __x.end(); ) + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 300. list::merge() specification incomplete + if (this != &__x) { - iterator __victim = __tmp++; - __victim._M_attach(&__x); + __glibcxx_check_sorted(_Base::begin(), _Base::end()); + __glibcxx_check_sorted(__x.begin().base(), __x.end().base()); + for (iterator __tmp = __x.begin(); __tmp != __x.end();) + { + iterator __victim = __tmp++; + this->_M_transfer_iter(__victim); + } + _Base::merge(_GLIBCXX_MOVE(__x._M_base())); } - _Base::merge(_GLIBCXX_MOVE(__x._M_base())); } template<class _Compare> @@ -545,15 +550,21 @@ namespace __debug merge(list& __x, _Compare __comp) #endif { - __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp); - __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(), - __comp); - for (iterator __tmp = __x.begin(); __tmp != __x.end(); ) + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 300. list::merge() specification incomplete + if (this != &__x) { - iterator __victim = __tmp++; - __victim._M_attach(&__x); + __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), + __comp); + __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(), + __comp); + for (iterator __tmp = __x.begin(); __tmp != __x.end();) + { + iterator __victim = __tmp++; + this->_M_transfer_iter(__victim); + } + _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); } - _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); } void diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h index 05bac1f46d4..82f9b0dea94 100644 --- a/libstdc++-v3/include/ext/atomicity.h +++ b/libstdc++-v3/include/ext/atomicity.h @@ -1,6 +1,6 @@ // Support for atomic operations -*- C++ -*- -// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2008 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 @@ -45,7 +45,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // To abstract locking primitives across all thread policies, use: // __exchange_and_add_dispatch // __atomic_add_dispatch -#ifdef _GLIBCXX_ATOMIC_BUILTINS +#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 static inline _Atomic_word __exchange_and_add(volatile _Atomic_word* __mem, int __val) { return __sync_fetch_and_add(__mem, __val); } diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h index e836b284fd3..397d7cbcb4f 100644 --- a/libstdc++-v3/include/parallel/algo.h +++ b/libstdc++-v3/include/parallel/algo.h @@ -72,51 +72,52 @@ namespace __parallel template<typename InputIterator, typename Function> inline Function for_each(InputIterator begin, InputIterator end, Function f, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::for_each(begin, end, f); } + // Sequential fallback for input iterator case template<typename InputIterator, typename Function, typename IteratorTag> inline Function for_each_switch(InputIterator begin, InputIterator end, Function f, - IteratorTag) + IteratorTag) { return for_each(begin, end, f, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator, typename Function> Function for_each_switch(RandomAccessIterator begin, RandomAccessIterator end, - Function f, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + Function f, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().for_each_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - bool dummy; - __gnu_parallel::for_each_selector<RandomAccessIterator> functionality; - - return __gnu_parallel:: - for_each_template_random_access(begin, end, f, functionality, - __gnu_parallel::dummy_reduct(), - true, dummy, -1, parallelism_tag); - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().for_each_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + bool dummy; + __gnu_parallel::for_each_selector<RandomAccessIterator> functionality; + + return __gnu_parallel:: + for_each_template_random_access(begin, end, f, functionality, + __gnu_parallel::dummy_reduct(), + true, dummy, -1, parallelism_tag); + } else - return for_each(begin, end, f, __gnu_parallel::sequential_tag()); + return for_each(begin, end, f, __gnu_parallel::sequential_tag()); } // Public interface template<typename Iterator, typename Function> inline Function for_each(Iterator begin, Iterator end, Function f, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<Iterator> iterator_traits; typedef typename iterator_traits::iterator_category iterator_category; return for_each_switch(begin, end, f, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename Iterator, typename Function> @@ -133,35 +134,35 @@ namespace __parallel template<typename InputIterator, typename T> inline InputIterator find(InputIterator begin, InputIterator end, const T& val, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::find(begin, end, val); } // Sequential fallback for input iterator case template<typename InputIterator, typename T, typename IteratorTag> inline InputIterator find_switch(InputIterator begin, InputIterator end, const T& val, - IteratorTag) + IteratorTag) { return _GLIBCXX_STD_P::find(begin, end, val); } // Parallel find for random access iterators template<typename RandomAccessIterator, typename T> RandomAccessIterator find_switch(RandomAccessIterator begin, RandomAccessIterator end, - const T& val, random_access_iterator_tag) + const T& val, random_access_iterator_tag) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; if (_GLIBCXX_PARALLEL_CONDITION(true)) - { - binder2nd<__gnu_parallel::equal_to<value_type, T> > - comp(__gnu_parallel::equal_to<value_type, T>(), val); - return __gnu_parallel::find_template(begin, end, begin, comp, - __gnu_parallel:: - find_if_selector()).first; - } + { + binder2nd<__gnu_parallel::equal_to<value_type, T> > + comp(__gnu_parallel::equal_to<value_type, T>(), val); + return __gnu_parallel::find_template(begin, end, begin, comp, + __gnu_parallel:: + find_if_selector()).first; + } else - return _GLIBCXX_STD_P::find(begin, end, val); + return _GLIBCXX_STD_P::find(begin, end, val); } // Public interface @@ -178,28 +179,28 @@ namespace __parallel template<typename InputIterator, typename Predicate> inline InputIterator find_if(InputIterator begin, InputIterator end, Predicate pred, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::find_if(begin, end, pred); } // Sequential fallback for input iterator case template<typename InputIterator, typename Predicate, typename IteratorTag> inline InputIterator find_if_switch(InputIterator begin, InputIterator end, Predicate pred, - IteratorTag) + IteratorTag) { return _GLIBCXX_STD_P::find_if(begin, end, pred); } // Parallel find_if for random access iterators template<typename RandomAccessIterator, typename Predicate> RandomAccessIterator find_if_switch(RandomAccessIterator begin, RandomAccessIterator end, - Predicate pred, random_access_iterator_tag) + Predicate pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) - return __gnu_parallel::find_template(begin, end, begin, pred, - __gnu_parallel:: - find_if_selector()).first; + return __gnu_parallel::find_template(begin, end, begin, pred, + __gnu_parallel:: + find_if_selector()).first; else - return _GLIBCXX_STD_P::find_if(begin, end, pred); + return _GLIBCXX_STD_P::find_if(begin, end, pred); } // Public interface @@ -216,63 +217,63 @@ namespace __parallel template<typename InputIterator, typename ForwardIterator> inline InputIterator find_first_of(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2, - __gnu_parallel::sequential_tag) + ForwardIterator begin2, ForwardIterator end2, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::find_first_of(begin1, end1, begin2, end2); } // Sequential fallback template<typename InputIterator, typename ForwardIterator, - typename BinaryPredicate> + typename BinaryPredicate> inline InputIterator find_first_of(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2, - BinaryPredicate comp, __gnu_parallel::sequential_tag) + ForwardIterator begin2, ForwardIterator end2, + BinaryPredicate comp, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::find_first_of(begin1, end1, begin2, end2, comp); } // Sequential fallback for input iterator type template<typename InputIterator, typename ForwardIterator, - typename IteratorTag1, typename IteratorTag2> + typename IteratorTag1, typename IteratorTag2> inline InputIterator find_first_of_switch(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2, - IteratorTag1, IteratorTag2) + ForwardIterator begin2, ForwardIterator end2, + IteratorTag1, IteratorTag2) { return find_first_of(begin1, end1, begin2, end2, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator, typename ForwardIterator, - typename BinaryPredicate, typename IteratorTag> + typename BinaryPredicate, typename IteratorTag> inline RandomAccessIterator find_first_of_switch(RandomAccessIterator begin1, - RandomAccessIterator end1, - ForwardIterator begin2, ForwardIterator end2, - BinaryPredicate comp, random_access_iterator_tag, - IteratorTag) + RandomAccessIterator end1, + ForwardIterator begin2, ForwardIterator end2, + BinaryPredicate comp, random_access_iterator_tag, + IteratorTag) { return __gnu_parallel:: - find_template(begin1, end1, begin1, comp, - __gnu_parallel::find_first_of_selector - <ForwardIterator>(begin2, end2)).first; + find_template(begin1, end1, begin1, comp, + __gnu_parallel::find_first_of_selector + <ForwardIterator>(begin2, end2)).first; } // Sequential fallback for input iterator type template<typename InputIterator, typename ForwardIterator, - typename BinaryPredicate, typename IteratorTag1, - typename IteratorTag2> + typename BinaryPredicate, typename IteratorTag1, + typename IteratorTag2> inline InputIterator find_first_of_switch(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2, - BinaryPredicate comp, IteratorTag1, IteratorTag2) + ForwardIterator begin2, ForwardIterator end2, + BinaryPredicate comp, IteratorTag1, IteratorTag2) { return find_first_of(begin1, end1, begin2, end2, comp, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Public interface template<typename InputIterator, typename ForwardIterator, - typename BinaryPredicate> + typename BinaryPredicate> inline InputIterator find_first_of(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2, - BinaryPredicate comp) + ForwardIterator begin2, ForwardIterator end2, + BinaryPredicate comp) { typedef std::iterator_traits<InputIterator> iteratori_traits; typedef std::iterator_traits<ForwardIterator> iteratorf_traits; @@ -280,14 +281,14 @@ namespace __parallel typedef typename iteratorf_traits::iterator_category iteratorf_category; return find_first_of_switch(begin1, end1, begin2, end2, comp, - iteratori_category(), iteratorf_category()); + iteratori_category(), iteratorf_category()); } // Public interface, insert default comparator template<typename InputIterator, typename ForwardIterator> inline InputIterator find_first_of(InputIterator begin1, InputIterator end1, - ForwardIterator begin2, ForwardIterator end2) + ForwardIterator begin2, ForwardIterator end2) { typedef std::iterator_traits<InputIterator> iteratori_traits; typedef std::iterator_traits<ForwardIterator> iteratorf_traits; @@ -295,47 +296,47 @@ namespace __parallel typedef typename iteratorf_traits::value_type valuef_type; return find_first_of(begin1, end1, begin2, end2, __gnu_parallel:: - equal_to<valuei_type, valuef_type>()); + equal_to<valuei_type, valuef_type>()); } // Sequential fallback template<typename InputIterator, typename OutputIterator> inline OutputIterator unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::unique_copy(begin1, end1, out); } // Sequential fallback template<typename InputIterator, typename OutputIterator, - typename Predicate> + typename Predicate> inline OutputIterator unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out, - Predicate pred, __gnu_parallel::sequential_tag) + Predicate pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::unique_copy(begin1, end1, out, pred); } // Sequential fallback for input iterator case template<typename InputIterator, typename OutputIterator, - typename Predicate, typename IteratorTag1, typename IteratorTag2> + typename Predicate, typename IteratorTag1, typename IteratorTag2> inline OutputIterator unique_copy_switch(InputIterator begin, InputIterator last, - OutputIterator out, Predicate pred, - IteratorTag1, IteratorTag2) + OutputIterator out, Predicate pred, + IteratorTag1, IteratorTag2) { return _GLIBCXX_STD_P::unique_copy(begin, last, out, pred); } // Parallel unique_copy for random access iterators template<typename RandomAccessIterator, typename RandomAccessOutputIterator, - typename Predicate> + typename Predicate> RandomAccessOutputIterator unique_copy_switch(RandomAccessIterator begin, RandomAccessIterator last, - RandomAccessOutputIterator out, Predicate pred, - random_access_iterator_tag, random_access_iterator_tag) + RandomAccessOutputIterator out, Predicate pred, + random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(last - begin) - > __gnu_parallel::_Settings::get().unique_copy_minimal_n)) - return __gnu_parallel::parallel_unique_copy(begin, last, out, pred); + static_cast<__gnu_parallel::sequence_index_t>(last - begin) + > __gnu_parallel::_Settings::get().unique_copy_minimal_n)) + return __gnu_parallel::parallel_unique_copy(begin, last, out, pred); else - return _GLIBCXX_STD_P::unique_copy(begin, last, out, pred); + return _GLIBCXX_STD_P::unique_copy(begin, last, out, pred); } // Public interface @@ -350,14 +351,14 @@ namespace __parallel typedef typename iteratoro_traits::iterator_category iteratoro_category; return unique_copy_switch(begin1, end1, out, equal_to<value_type>(), - iteratori_category(), iteratoro_category()); + iteratori_category(), iteratoro_category()); } // Public interface template<typename InputIterator, typename OutputIterator, typename Predicate> inline OutputIterator unique_copy(InputIterator begin1, InputIterator end1, OutputIterator out, - Predicate pred) + Predicate pred) { typedef std::iterator_traits<InputIterator> iteratori_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; @@ -365,484 +366,484 @@ namespace __parallel typedef typename iteratoro_traits::iterator_category iteratoro_category; return unique_copy_switch(begin1, end1, out, pred, iteratori_category(), - iteratoro_category()); + iteratoro_category()); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_union(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_union(begin1, end1, begin2, end2, out); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_union(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred, - __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_union(begin1, end1, - begin2, end2, out, pred); } + begin2, end2, out, pred); } // Sequential fallback for input iterator case template<typename InputIterator1, typename InputIterator2, - typename Predicate, typename OutputIterator, - typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> + typename Predicate, typename OutputIterator, + typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> inline OutputIterator set_union_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator result, Predicate pred, IteratorTag1, - IteratorTag2, IteratorTag3) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator result, Predicate pred, IteratorTag1, + IteratorTag2, IteratorTag3) { return _GLIBCXX_STD_P::set_union(begin1, end1, - begin2, end2, result, pred); } + begin2, end2, result, pred); } // Parallel set_union for random access iterators template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename OutputRandomAccessIterator, typename Predicate> + typename OutputRandomAccessIterator, typename Predicate> OutputRandomAccessIterator set_union_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, RandomAccessIterator2 end2, - OutputRandomAccessIterator result, Predicate pred, - random_access_iterator_tag, random_access_iterator_tag, - random_access_iterator_tag) + RandomAccessIterator2 begin2, RandomAccessIterator2 end2, + OutputRandomAccessIterator result, Predicate pred, + random_access_iterator_tag, random_access_iterator_tag, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) - >= __gnu_parallel::_Settings::get().set_union_minimal_n - || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) - >= __gnu_parallel::_Settings::get().set_union_minimal_n)) - return __gnu_parallel::parallel_set_union(begin1, end1, - begin2, end2, result, pred); + static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) + >= __gnu_parallel::_Settings::get().set_union_minimal_n + || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) + >= __gnu_parallel::_Settings::get().set_union_minimal_n)) + return __gnu_parallel::parallel_set_union(begin1, end1, + begin2, end2, result, pred); else - return _GLIBCXX_STD_P::set_union(begin1, end1, - begin2, end2, result, pred); + return _GLIBCXX_STD_P::set_union(begin1, end1, + begin2, end2, result, pred); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_union(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, OutputIterator out) + InputIterator2 begin2, InputIterator2 end2, OutputIterator out) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; typedef typename iteratori1_traits::value_type value1_type; typedef typename iteratori2_traits::value_type value2_type; return set_union_switch(begin1, end1, begin2, end2, out, - __gnu_parallel::less<value1_type, value2_type>(), - iteratori1_category(), iteratori2_category(), - iteratoro_category()); + __gnu_parallel::less<value1_type, value2_type>(), + iteratori1_category(), iteratori2_category(), + iteratoro_category()); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_union(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; return set_union_switch(begin1, end1, begin2, end2, out, pred, - iteratori1_category(), iteratori2_category(), - iteratoro_category()); + iteratori1_category(), iteratori2_category(), + iteratoro_category()); } // Sequential fallback. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_intersection(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_intersection(begin1, end1, - begin2, end2, out); } + begin2, end2, out); } // Sequential fallback. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_intersection(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred, - __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2, end2, - out, pred); } + out, pred); } // Sequential fallback for input iterator case template<typename InputIterator1, typename InputIterator2, - typename Predicate, typename OutputIterator, - typename IteratorTag1, typename IteratorTag2, - typename IteratorTag3> + typename Predicate, typename OutputIterator, + typename IteratorTag1, typename IteratorTag2, + typename IteratorTag3> inline OutputIterator set_intersection_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator result, Predicate pred, - IteratorTag1, IteratorTag2, IteratorTag3) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator result, Predicate pred, + IteratorTag1, IteratorTag2, IteratorTag3) { return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2, - end2, result, pred); } + end2, result, pred); } // Parallel set_intersection for random access iterators template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename OutputRandomAccessIterator, typename Predicate> + typename OutputRandomAccessIterator, typename Predicate> OutputRandomAccessIterator set_intersection_switch(RandomAccessIterator1 begin1, - RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, - RandomAccessIterator2 end2, - OutputRandomAccessIterator result, - Predicate pred, - random_access_iterator_tag, - random_access_iterator_tag, - random_access_iterator_tag) + RandomAccessIterator1 end1, + RandomAccessIterator2 begin2, + RandomAccessIterator2 end2, + OutputRandomAccessIterator result, + Predicate pred, + random_access_iterator_tag, + random_access_iterator_tag, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) - >= __gnu_parallel::_Settings::get().set_union_minimal_n - || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) - >= __gnu_parallel::_Settings::get().set_union_minimal_n)) - return __gnu_parallel::parallel_set_intersection(begin1, end1, begin2, - end2, result, pred); + static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) + >= __gnu_parallel::_Settings::get().set_union_minimal_n + || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) + >= __gnu_parallel::_Settings::get().set_union_minimal_n)) + return __gnu_parallel::parallel_set_intersection(begin1, end1, begin2, + end2, result, pred); else - return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2, - end2, result, pred); + return _GLIBCXX_STD_P::set_intersection(begin1, end1, begin2, + end2, result, pred); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_intersection(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; typedef typename iteratori1_traits::value_type value1_type; typedef typename iteratori2_traits::value_type value2_type; return set_intersection_switch(begin1, end1, begin2, end2, out, - __gnu_parallel:: - less<value1_type, value2_type>(), - iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + __gnu_parallel:: + less<value1_type, value2_type>(), + iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_intersection(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; return set_intersection_switch(begin1, end1, begin2, end2, out, pred, - iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, - __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_symmetric_difference(begin1,end1, - begin2, end2, out); } + begin2, end2, out); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred, - __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1, begin2, - end2, out, pred); } + end2, out, pred); } // Sequential fallback for input iterator case template<typename InputIterator1, typename InputIterator2, - typename Predicate, typename OutputIterator, - typename IteratorTag1, typename IteratorTag2, - typename IteratorTag3> + typename Predicate, typename OutputIterator, + typename IteratorTag1, typename IteratorTag2, + typename IteratorTag3> inline OutputIterator set_symmetric_difference_switch(InputIterator1 begin1, - InputIterator1 end1, - InputIterator2 begin2, - InputIterator2 end2, - OutputIterator result, Predicate pred, - IteratorTag1, IteratorTag2, IteratorTag3) + InputIterator1 end1, + InputIterator2 begin2, + InputIterator2 end2, + OutputIterator result, Predicate pred, + IteratorTag1, IteratorTag2, IteratorTag3) { return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1, - begin2, end2, - result, pred); } + begin2, end2, + result, pred); } // Parallel set_symmetric_difference for random access iterators template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename OutputRandomAccessIterator, typename Predicate> + typename OutputRandomAccessIterator, typename Predicate> OutputRandomAccessIterator set_symmetric_difference_switch(RandomAccessIterator1 begin1, - RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, - RandomAccessIterator2 end2, - OutputRandomAccessIterator result, - Predicate pred, - random_access_iterator_tag, - random_access_iterator_tag, - random_access_iterator_tag) + RandomAccessIterator1 end1, + RandomAccessIterator2 begin2, + RandomAccessIterator2 end2, + OutputRandomAccessIterator result, + Predicate pred, + random_access_iterator_tag, + random_access_iterator_tag, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) - >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n - || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) - >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n)) - return __gnu_parallel::parallel_set_symmetric_difference(begin1, end1, - begin2, end2, - result, pred); + static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) + >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n + || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) + >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n)) + return __gnu_parallel::parallel_set_symmetric_difference(begin1, end1, + begin2, end2, + result, pred); else - return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1, - begin2, end2, - result, pred); + return _GLIBCXX_STD_P::set_symmetric_difference(begin1, end1, + begin2, end2, + result, pred); } // Public interface. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; typedef typename iteratori1_traits::value_type value1_type; typedef typename iteratori2_traits::value_type value2_type; return set_symmetric_difference_switch(begin1, end1, begin2, end2, out, - __gnu_parallel:: - less<value1_type, value2_type>(), - iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + __gnu_parallel:: + less<value1_type, value2_type>(), + iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } // Public interface. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_symmetric_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; return set_symmetric_difference_switch(begin1, end1, begin2, end2, out, - pred, iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + pred, iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } // Sequential fallback. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_difference(begin1,end1, begin2, end2, out); } // Sequential fallback. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred, - __gnu_parallel::sequential_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::set_difference(begin1, end1, - begin2, end2, out, pred); } + begin2, end2, out, pred); } // Sequential fallback for input iterator case. template<typename InputIterator1, typename InputIterator2, - typename Predicate, typename OutputIterator, - typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> + typename Predicate, typename OutputIterator, + typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> inline OutputIterator set_difference_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator result, Predicate pred, - IteratorTag1, IteratorTag2, IteratorTag3) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator result, Predicate pred, + IteratorTag1, IteratorTag2, IteratorTag3) { return _GLIBCXX_STD_P::set_difference(begin1, end1, - begin2, end2, result, pred); } + begin2, end2, result, pred); } // Parallel set_difference for random access iterators template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename OutputRandomAccessIterator, typename Predicate> + typename OutputRandomAccessIterator, typename Predicate> OutputRandomAccessIterator set_difference_switch(RandomAccessIterator1 begin1, - RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, - RandomAccessIterator2 end2, - OutputRandomAccessIterator result, Predicate pred, - random_access_iterator_tag, - random_access_iterator_tag, - random_access_iterator_tag) + RandomAccessIterator1 end1, + RandomAccessIterator2 begin2, + RandomAccessIterator2 end2, + OutputRandomAccessIterator result, Predicate pred, + random_access_iterator_tag, + random_access_iterator_tag, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) - >= __gnu_parallel::_Settings::get().set_difference_minimal_n - || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) - >= __gnu_parallel::_Settings::get().set_difference_minimal_n)) - return __gnu_parallel::parallel_set_difference(begin1, end1, - begin2, end2, - result, pred); + static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) + >= __gnu_parallel::_Settings::get().set_difference_minimal_n + || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) + >= __gnu_parallel::_Settings::get().set_difference_minimal_n)) + return __gnu_parallel::parallel_set_difference(begin1, end1, + begin2, end2, + result, pred); else - return _GLIBCXX_STD_P::set_difference(begin1, end1, - begin2, end2, result, pred); + return _GLIBCXX_STD_P::set_difference(begin1, end1, + begin2, end2, result, pred); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator set_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; typedef typename iteratori1_traits::value_type value1_type; typedef typename iteratori2_traits::value_type value2_type; return set_difference_switch(begin1, end1, begin2, end2, out, - __gnu_parallel:: - less<value1_type, value2_type>(), - iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + __gnu_parallel:: + less<value1_type, value2_type>(), + iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Predicate> + typename OutputIterator, typename Predicate> inline OutputIterator set_difference(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator out, Predicate pred) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator out, Predicate pred) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; return set_difference_switch(begin1, end1, begin2, end2, out, pred, - iteratori1_category(), - iteratori2_category(), - iteratoro_category()); + iteratori1_category(), + iteratori2_category(), + iteratoro_category()); } // Sequential fallback template<typename ForwardIterator> inline ForwardIterator adjacent_find(ForwardIterator begin, ForwardIterator end, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::adjacent_find(begin, end); } // Sequential fallback template<typename ForwardIterator, typename BinaryPredicate> inline ForwardIterator adjacent_find(ForwardIterator begin, ForwardIterator end, - BinaryPredicate binary_pred, __gnu_parallel::sequential_tag) + BinaryPredicate binary_pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::adjacent_find(begin, end, binary_pred); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator> RandomAccessIterator adjacent_find_switch(RandomAccessIterator begin, RandomAccessIterator end, - random_access_iterator_tag) + random_access_iterator_tag) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; if (_GLIBCXX_PARALLEL_CONDITION(true)) - { - RandomAccessIterator spot = __gnu_parallel:: - find_template(begin, end - 1, begin, equal_to<value_type>(), - __gnu_parallel::adjacent_find_selector()).first; - if (spot == (end - 1)) - return end; - else - return spot; - } + { + RandomAccessIterator spot = __gnu_parallel:: + find_template(begin, end - 1, begin, equal_to<value_type>(), + __gnu_parallel::adjacent_find_selector()).first; + if (spot == (end - 1)) + return end; + else + return spot; + } else - return adjacent_find(begin, end, __gnu_parallel::sequential_tag()); + return adjacent_find(begin, end, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename ForwardIterator, typename IteratorTag> inline ForwardIterator adjacent_find_switch(ForwardIterator begin, ForwardIterator end, - IteratorTag) + IteratorTag) { return adjacent_find(begin, end, __gnu_parallel::sequential_tag()); } // Public interface @@ -857,33 +858,33 @@ namespace __parallel // Sequential fallback for input iterator case template<typename ForwardIterator, typename BinaryPredicate, - typename IteratorTag> + typename IteratorTag> inline ForwardIterator adjacent_find_switch(ForwardIterator begin, ForwardIterator end, - BinaryPredicate pred, IteratorTag) + BinaryPredicate pred, IteratorTag) { return adjacent_find(begin, end, pred, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator, typename BinaryPredicate> RandomAccessIterator adjacent_find_switch(RandomAccessIterator begin, RandomAccessIterator end, - BinaryPredicate pred, random_access_iterator_tag) + BinaryPredicate pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) - return __gnu_parallel::find_template(begin, end, begin, pred, - __gnu_parallel:: - adjacent_find_selector()).first; + return __gnu_parallel::find_template(begin, end, begin, pred, + __gnu_parallel:: + adjacent_find_selector()).first; else - return adjacent_find(begin, end, pred, - __gnu_parallel::sequential_tag()); + return adjacent_find(begin, end, pred, + __gnu_parallel::sequential_tag()); } // Public interface template<typename ForwardIterator, typename BinaryPredicate> inline ForwardIterator adjacent_find(ForwardIterator begin, ForwardIterator end, - BinaryPredicate pred) + BinaryPredicate pred) { typedef iterator_traits<ForwardIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; @@ -894,16 +895,16 @@ namespace __parallel template<typename InputIterator, typename T> inline typename iterator_traits<InputIterator>::difference_type count(InputIterator begin, InputIterator end, const T& value, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::count(begin, end, value); } // Parallel code for random access iterators template<typename RandomAccessIterator, typename T> typename iterator_traits<RandomAccessIterator>::difference_type count_switch(RandomAccessIterator begin, RandomAccessIterator end, - const T& value, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_unbalanced) + const T& value, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_unbalanced) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; @@ -911,41 +912,41 @@ namespace __parallel typedef __gnu_parallel::sequence_index_t sequence_index_t; if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().count_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - __gnu_parallel::count_selector<RandomAccessIterator, difference_type> - functionality; - difference_type res = 0; - __gnu_parallel:: - for_each_template_random_access(begin, end, value, - functionality, - std::plus<sequence_index_t>(), - res, res, -1, parallelism_tag); - return res; - } + static_cast<sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().count_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + __gnu_parallel::count_selector<RandomAccessIterator, difference_type> + functionality; + difference_type res = 0; + __gnu_parallel:: + for_each_template_random_access(begin, end, value, + functionality, + std::plus<sequence_index_t>(), + res, res, -1, parallelism_tag); + return res; + } else - return count(begin, end, value, __gnu_parallel::sequential_tag()); + return count(begin, end, value, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename InputIterator, typename T, typename IteratorTag> inline typename iterator_traits<InputIterator>::difference_type count_switch(InputIterator begin, InputIterator end, const T& value, - IteratorTag) + IteratorTag) { return count(begin, end, value, __gnu_parallel::sequential_tag()); } // Public interface. template<typename InputIterator, typename T> inline typename iterator_traits<InputIterator>::difference_type count(InputIterator begin, InputIterator end, const T& value, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef iterator_traits<InputIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; return count_switch(begin, end, value, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename InputIterator, typename T> @@ -962,16 +963,16 @@ namespace __parallel template<typename InputIterator, typename Predicate> inline typename iterator_traits<InputIterator>::difference_type count_if(InputIterator begin, InputIterator end, Predicate pred, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::count_if(begin, end, pred); } // Parallel count_if for random access iterators template<typename RandomAccessIterator, typename Predicate> typename iterator_traits<RandomAccessIterator>::difference_type count_if_switch(RandomAccessIterator begin, RandomAccessIterator end, - Predicate pred, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_unbalanced) + Predicate pred, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_unbalanced) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; @@ -979,42 +980,42 @@ namespace __parallel typedef __gnu_parallel::sequence_index_t sequence_index_t; if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().count_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - difference_type res = 0; - __gnu_parallel:: - count_if_selector<RandomAccessIterator, difference_type> - functionality; - __gnu_parallel:: - for_each_template_random_access(begin, end, pred, - functionality, - std::plus<sequence_index_t>(), - res, res, -1, parallelism_tag); - return res; - } + static_cast<sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().count_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + difference_type res = 0; + __gnu_parallel:: + count_if_selector<RandomAccessIterator, difference_type> + functionality; + __gnu_parallel:: + for_each_template_random_access(begin, end, pred, + functionality, + std::plus<sequence_index_t>(), + res, res, -1, parallelism_tag); + return res; + } else - return count_if(begin, end, pred, __gnu_parallel::sequential_tag()); + return count_if(begin, end, pred, __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename InputIterator, typename Predicate, typename IteratorTag> inline typename iterator_traits<InputIterator>::difference_type count_if_switch(InputIterator begin, InputIterator end, Predicate pred, - IteratorTag) + IteratorTag) { return count_if(begin, end, pred, __gnu_parallel::sequential_tag()); } // Public interface. template<typename InputIterator, typename Predicate> inline typename iterator_traits<InputIterator>::difference_type count_if(InputIterator begin, InputIterator end, Predicate pred, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef iterator_traits<InputIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; return count_if_switch(begin, end, pred, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename InputIterator, typename Predicate> @@ -1031,16 +1032,16 @@ namespace __parallel template<typename ForwardIterator1, typename ForwardIterator2> inline ForwardIterator1 search(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2, - __gnu_parallel::sequential_tag) + ForwardIterator2 begin2, ForwardIterator2 end2, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::search(begin1, end1, begin2, end2); } // Parallel algorithm for random access iterator template<typename RandomAccessIterator1, typename RandomAccessIterator2> RandomAccessIterator1 search_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, RandomAccessIterator2 end2, - random_access_iterator_tag, random_access_iterator_tag) + RandomAccessIterator2 begin2, RandomAccessIterator2 end2, + random_access_iterator_tag, random_access_iterator_tag) { typedef std::iterator_traits<RandomAccessIterator1> iterator1_traits; typedef typename iterator1_traits::value_type value1_type; @@ -1048,29 +1049,29 @@ namespace __parallel typedef typename iterator2_traits::value_type value2_type; if (_GLIBCXX_PARALLEL_CONDITION(true)) - return __gnu_parallel:: - search_template(begin1, end1, begin2, end2, __gnu_parallel:: - equal_to<value1_type, value2_type>()); + return __gnu_parallel:: + search_template(begin1, end1, begin2, end2, __gnu_parallel:: + equal_to<value1_type, value2_type>()); else - return search(begin1, end1, begin2, end2, - __gnu_parallel::sequential_tag()); + return search(begin1, end1, begin2, end2, + __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename ForwardIterator1, typename ForwardIterator2, - typename IteratorTag1, typename IteratorTag2> + typename IteratorTag1, typename IteratorTag2> inline ForwardIterator1 search_switch(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2, - IteratorTag1, IteratorTag2) + ForwardIterator2 begin2, ForwardIterator2 end2, + IteratorTag1, IteratorTag2) { return search(begin1, end1, begin2, end2, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Public interface. template<typename ForwardIterator1, typename ForwardIterator2> inline ForwardIterator1 search(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2) + ForwardIterator2 begin2, ForwardIterator2 end2) { typedef std::iterator_traits<ForwardIterator1> iterator1_traits; typedef typename iterator1_traits::iterator_category iterator1_category; @@ -1078,187 +1079,187 @@ namespace __parallel typedef typename iterator2_traits::iterator_category iterator2_category; return search_switch(begin1, end1, begin2, end2, - iterator1_category(), iterator2_category()); + iterator1_category(), iterator2_category()); } // Public interface. template<typename ForwardIterator1, typename ForwardIterator2, - typename BinaryPredicate> + typename BinaryPredicate> inline ForwardIterator1 search(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2, - BinaryPredicate pred, __gnu_parallel::sequential_tag) + ForwardIterator2 begin2, ForwardIterator2 end2, + BinaryPredicate pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::search(begin1, end1, begin2, end2, pred); } // Parallel algorithm for random access iterator. template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename BinaryPredicate> + typename BinaryPredicate> RandomAccessIterator1 search_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, RandomAccessIterator2 end2, - BinaryPredicate pred, - random_access_iterator_tag, random_access_iterator_tag) + RandomAccessIterator2 begin2, RandomAccessIterator2 end2, + BinaryPredicate pred, + random_access_iterator_tag, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) - return __gnu_parallel::search_template(begin1, end1, - begin2, end2, pred); + return __gnu_parallel::search_template(begin1, end1, + begin2, end2, pred); else - return search(begin1, end1, begin2, end2, pred, - __gnu_parallel::sequential_tag()); + return search(begin1, end1, begin2, end2, pred, + __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case template<typename ForwardIterator1, typename ForwardIterator2, - typename BinaryPredicate, typename IteratorTag1, - typename IteratorTag2> + typename BinaryPredicate, typename IteratorTag1, + typename IteratorTag2> inline ForwardIterator1 search_switch(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2, - BinaryPredicate pred, IteratorTag1, IteratorTag2) + ForwardIterator2 begin2, ForwardIterator2 end2, + BinaryPredicate pred, IteratorTag1, IteratorTag2) { return search(begin1, end1, begin2, end2, pred, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Public interface template<typename ForwardIterator1, typename ForwardIterator2, - typename BinaryPredicate> + typename BinaryPredicate> inline ForwardIterator1 search(ForwardIterator1 begin1, ForwardIterator1 end1, - ForwardIterator2 begin2, ForwardIterator2 end2, - BinaryPredicate pred) + ForwardIterator2 begin2, ForwardIterator2 end2, + BinaryPredicate pred) { typedef std::iterator_traits<ForwardIterator1> iterator1_traits; typedef typename iterator1_traits::iterator_category iterator1_category; typedef std::iterator_traits<ForwardIterator2> iterator2_traits; typedef typename iterator2_traits::iterator_category iterator2_category; return search_switch(begin1, end1, begin2, end2, pred, - iterator1_category(), iterator2_category()); + iterator1_category(), iterator2_category()); } // Sequential fallback template<typename ForwardIterator, typename Integer, typename T> inline ForwardIterator search_n(ForwardIterator begin, ForwardIterator end, Integer count, - const T& val, __gnu_parallel::sequential_tag) + const T& val, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::search_n(begin, end, count, val); } // Sequential fallback template<typename ForwardIterator, typename Integer, typename T, - typename BinaryPredicate> + typename BinaryPredicate> inline ForwardIterator search_n(ForwardIterator begin, ForwardIterator end, Integer count, - const T& val, BinaryPredicate binary_pred, - __gnu_parallel::sequential_tag) + const T& val, BinaryPredicate binary_pred, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::search_n(begin, end, count, val, binary_pred); } // Public interface. template<typename ForwardIterator, typename Integer, typename T> inline ForwardIterator search_n(ForwardIterator begin, ForwardIterator end, Integer count, - const T& val) + const T& val) { typedef typename iterator_traits<ForwardIterator>::value_type value_type; return search_n(begin, end, count, val, - __gnu_parallel::equal_to<value_type, T>()); + __gnu_parallel::equal_to<value_type, T>()); } // Parallel algorithm for random access iterators. template<typename RandomAccessIterator, typename Integer, - typename T, typename BinaryPredicate> + typename T, typename BinaryPredicate> RandomAccessIterator search_n_switch(RandomAccessIterator begin, RandomAccessIterator end, - Integer count, const T& val, BinaryPredicate binary_pred, - random_access_iterator_tag) + Integer count, const T& val, BinaryPredicate binary_pred, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION(true)) - { - __gnu_parallel::pseudo_sequence<T, Integer> ps(val, count); - return __gnu_parallel::search_template(begin, end, ps.begin(), - ps.end(), binary_pred); - } + { + __gnu_parallel::pseudo_sequence<T, Integer> ps(val, count); + return __gnu_parallel::search_template(begin, end, ps.begin(), + ps.end(), binary_pred); + } else - return std::__search_n(begin, end, count, val, - binary_pred, random_access_iterator_tag()); + return std::__search_n(begin, end, count, val, + binary_pred, random_access_iterator_tag()); } // Sequential fallback for input iterator case. template<typename ForwardIterator, typename Integer, typename T, - typename BinaryPredicate, typename IteratorTag> + typename BinaryPredicate, typename IteratorTag> inline ForwardIterator search_n_switch(ForwardIterator begin, ForwardIterator end, Integer count, - const T& val, BinaryPredicate binary_pred, IteratorTag) + const T& val, BinaryPredicate binary_pred, IteratorTag) { return __search_n(begin, end, count, val, binary_pred, IteratorTag()); } // Public interface. template<typename ForwardIterator, typename Integer, typename T, - typename BinaryPredicate> + typename BinaryPredicate> inline ForwardIterator search_n(ForwardIterator begin, ForwardIterator end, Integer count, - const T& val, BinaryPredicate binary_pred) + const T& val, BinaryPredicate binary_pred) { return search_n_switch(begin, end, count, val, binary_pred, - typename std::iterator_traits<ForwardIterator>:: - iterator_category()); + typename std::iterator_traits<ForwardIterator>:: + iterator_category()); } // Sequential fallback. template<typename InputIterator, typename OutputIterator, - typename UnaryOperation> + typename UnaryOperation> inline OutputIterator transform(InputIterator begin, InputIterator end, OutputIterator result, - UnaryOperation unary_op, __gnu_parallel::sequential_tag) + UnaryOperation unary_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::transform(begin, end, result, unary_op); } // Parallel unary transform for random access iterators. template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename UnaryOperation> + typename UnaryOperation> RandomAccessIterator2 transform1_switch(RandomAccessIterator1 begin, RandomAccessIterator1 end, - RandomAccessIterator2 result, UnaryOperation unary_op, - random_access_iterator_tag, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + RandomAccessIterator2 result, UnaryOperation unary_op, + random_access_iterator_tag, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().transform_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - bool dummy = true; - typedef __gnu_parallel::iterator_pair<RandomAccessIterator1, - RandomAccessIterator2, random_access_iterator_tag> ip; - ip begin_pair(begin, result), end_pair(end, result + (end - begin)); - __gnu_parallel::transform1_selector<ip> functionality; - __gnu_parallel:: - for_each_template_random_access(begin_pair, end_pair, - unary_op, functionality, - __gnu_parallel::dummy_reduct(), - dummy, dummy, -1, parallelism_tag); - return functionality.finish_iterator; - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().transform_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + bool dummy = true; + typedef __gnu_parallel::iterator_pair<RandomAccessIterator1, + RandomAccessIterator2, random_access_iterator_tag> ip; + ip begin_pair(begin, result), end_pair(end, result + (end - begin)); + __gnu_parallel::transform1_selector<ip> functionality; + __gnu_parallel:: + for_each_template_random_access(begin_pair, end_pair, + unary_op, functionality, + __gnu_parallel::dummy_reduct(), + dummy, dummy, -1, parallelism_tag); + return functionality.finish_iterator; + } else - return transform(begin, end, result, unary_op, - __gnu_parallel::sequential_tag()); + return transform(begin, end, result, unary_op, + __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename UnaryOperation, typename IteratorTag1, - typename IteratorTag2> + typename UnaryOperation, typename IteratorTag1, + typename IteratorTag2> inline RandomAccessIterator2 transform1_switch(RandomAccessIterator1 begin, RandomAccessIterator1 end, - RandomAccessIterator2 result, UnaryOperation unary_op, - IteratorTag1, IteratorTag2) + RandomAccessIterator2 result, UnaryOperation unary_op, + IteratorTag1, IteratorTag2) { return transform(begin, end, result, unary_op, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Public interface. template<typename InputIterator, typename OutputIterator, - typename UnaryOperation> + typename UnaryOperation> inline OutputIterator transform(InputIterator begin, InputIterator end, OutputIterator result, - UnaryOperation unary_op, - __gnu_parallel::_Parallelism parallelism_tag) + UnaryOperation unary_op, + __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<InputIterator> iteratori_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; @@ -1266,15 +1267,15 @@ namespace __parallel typedef typename iteratoro_traits::iterator_category iteratoro_category; return transform1_switch(begin, end, result, unary_op, - iteratori_category(), iteratoro_category(), - parallelism_tag); + iteratori_category(), iteratoro_category(), + parallelism_tag); } template<typename InputIterator, typename OutputIterator, - typename UnaryOperation> + typename UnaryOperation> inline OutputIterator transform(InputIterator begin, InputIterator end, OutputIterator result, - UnaryOperation unary_op) + UnaryOperation unary_op) { typedef std::iterator_traits<InputIterator> iteratori_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; @@ -1282,157 +1283,158 @@ namespace __parallel typedef typename iteratoro_traits::iterator_category iteratoro_category; return transform1_switch(begin, end, result, unary_op, - iteratori_category(), iteratoro_category()); + iteratori_category(), iteratoro_category()); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename BinaryOperation> + typename OutputIterator, typename BinaryOperation> inline OutputIterator transform(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, OutputIterator result, - BinaryOperation binary_op, __gnu_parallel::sequential_tag) + InputIterator2 begin2, OutputIterator result, + BinaryOperation binary_op, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::transform(begin1, end1, - begin2, result, binary_op); } + begin2, result, binary_op); } // Parallel binary transform for random access iterators. template<typename RandomAccessIterator1, typename RandomAccessIterator2, - typename RandomAccessIterator3, typename BinaryOperation> + typename RandomAccessIterator3, typename BinaryOperation> RandomAccessIterator3 transform2_switch(RandomAccessIterator1 begin1, RandomAccessIterator1 end1, - RandomAccessIterator2 begin2, - RandomAccessIterator3 result, BinaryOperation binary_op, - random_access_iterator_tag, random_access_iterator_tag, - random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + RandomAccessIterator2 begin2, + RandomAccessIterator3 result, BinaryOperation binary_op, + random_access_iterator_tag, random_access_iterator_tag, + random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - (end1 - begin1) >= __gnu_parallel::_Settings::get().transform_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - bool dummy = true; - typedef __gnu_parallel::iterator_triple<RandomAccessIterator1, - RandomAccessIterator2, RandomAccessIterator3, - random_access_iterator_tag> ip; - ip begin_triple(begin1, begin2, result), - end_triple(end1, begin2 + (end1 - begin1), - result + (end1 - begin1)); - __gnu_parallel::transform2_selector<ip> functionality; - __gnu_parallel:: - for_each_template_random_access(begin_triple, end_triple, - binary_op, functionality, - __gnu_parallel::dummy_reduct(), - dummy, dummy, -1, - parallelism_tag); - return functionality.finish_iterator; - } + (end1 - begin1) >= + __gnu_parallel::_Settings::get().transform_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + bool dummy = true; + typedef __gnu_parallel::iterator_triple<RandomAccessIterator1, + RandomAccessIterator2, RandomAccessIterator3, + random_access_iterator_tag> ip; + ip begin_triple(begin1, begin2, result), + end_triple(end1, begin2 + (end1 - begin1), + result + (end1 - begin1)); + __gnu_parallel::transform2_selector<ip> functionality; + __gnu_parallel:: + for_each_template_random_access(begin_triple, end_triple, + binary_op, functionality, + __gnu_parallel::dummy_reduct(), + dummy, dummy, -1, + parallelism_tag); + return functionality.finish_iterator; + } else - return transform(begin1, end1, begin2, result, binary_op, - __gnu_parallel::sequential_tag()); + return transform(begin1, end1, begin2, result, binary_op, + __gnu_parallel::sequential_tag()); } // Sequential fallback for input iterator case. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename BinaryOperation, - typename tag1, typename tag2, typename tag3> + typename OutputIterator, typename BinaryOperation, + typename tag1, typename tag2, typename tag3> inline OutputIterator transform2_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, OutputIterator result, - BinaryOperation binary_op, tag1, tag2, tag3) + InputIterator2 begin2, OutputIterator result, + BinaryOperation binary_op, tag1, tag2, tag3) { return transform(begin1, end1, begin2, result, binary_op, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Public interface. template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename BinaryOperation> + typename OutputIterator, typename BinaryOperation> inline OutputIterator transform(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, OutputIterator result, - BinaryOperation binary_op, - __gnu_parallel::_Parallelism parallelism_tag) + InputIterator2 begin2, OutputIterator result, + BinaryOperation binary_op, + __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratoro_traits::iterator_category iteratoro_category; return transform2_switch(begin1, end1, begin2, result, binary_op, - iteratori1_category(), iteratori2_category(), - iteratoro_category(), parallelism_tag); + iteratori1_category(), iteratori2_category(), + iteratoro_category(), parallelism_tag); } template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename BinaryOperation> + typename OutputIterator, typename BinaryOperation> inline OutputIterator transform(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, OutputIterator result, - BinaryOperation binary_op) + InputIterator2 begin2, OutputIterator result, + BinaryOperation binary_op) { typedef std::iterator_traits<InputIterator1> iteratori1_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratoro_traits::iterator_category iteratoro_category; return transform2_switch(begin1, end1, begin2, result, binary_op, - iteratori1_category(), iteratori2_category(), - iteratoro_category()); + iteratori1_category(), iteratori2_category(), + iteratoro_category()); } // Sequential fallback template<typename ForwardIterator, typename T> inline void replace(ForwardIterator begin, ForwardIterator end, const T& old_value, - const T& new_value, __gnu_parallel::sequential_tag) + const T& new_value, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::replace(begin, end, old_value, new_value); } // Sequential fallback for input iterator case template<typename ForwardIterator, typename T, typename IteratorTag> inline void replace_switch(ForwardIterator begin, ForwardIterator end, - const T& old_value, const T& new_value, IteratorTag) + const T& old_value, const T& new_value, IteratorTag) { replace(begin, end, old_value, new_value, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Parallel replace for random access iterators template<typename RandomAccessIterator, typename T> inline void replace_switch(RandomAccessIterator begin, RandomAccessIterator end, - const T& old_value, const T& new_value, - random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + const T& old_value, const T& new_value, + random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { // XXX parallel version is where? replace(begin, end, old_value, new_value, - __gnu_parallel::sequential_tag()); + __gnu_parallel::sequential_tag()); } // Public interface template<typename ForwardIterator, typename T> inline void replace(ForwardIterator begin, ForwardIterator end, const T& old_value, - const T& new_value, __gnu_parallel::_Parallelism parallelism_tag) + const T& new_value, __gnu_parallel::_Parallelism parallelism_tag) { typedef iterator_traits<ForwardIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; replace_switch(begin, end, old_value, new_value, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename ForwardIterator, typename T> inline void replace(ForwardIterator begin, ForwardIterator end, const T& old_value, - const T& new_value) + const T& new_value) { typedef iterator_traits<ForwardIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; @@ -1444,64 +1446,64 @@ namespace __parallel template<typename ForwardIterator, typename Predicate, typename T> inline void replace_if(ForwardIterator begin, ForwardIterator end, Predicate pred, - const T& new_value, __gnu_parallel::sequential_tag) + const T& new_value, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::replace_if(begin, end, pred, new_value); } // Sequential fallback for input iterator case template<typename ForwardIterator, typename Predicate, typename T, - typename IteratorTag> + typename IteratorTag> inline void replace_if_switch(ForwardIterator begin, ForwardIterator end, - Predicate pred, const T& new_value, IteratorTag) + Predicate pred, const T& new_value, IteratorTag) { replace_if(begin, end, pred, new_value, - __gnu_parallel::sequential_tag()); } + __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename RandomAccessIterator, typename Predicate, typename T> void replace_if_switch(RandomAccessIterator begin, RandomAccessIterator end, - Predicate pred, const T& new_value, - random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + Predicate pred, const T& new_value, + random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().replace_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - bool dummy; - __gnu_parallel:: - replace_if_selector<RandomAccessIterator, Predicate, T> - functionality(new_value); - __gnu_parallel:: - for_each_template_random_access(begin, end, pred, - functionality, - __gnu_parallel::dummy_reduct(), - true, dummy, -1, parallelism_tag); - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().replace_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + bool dummy; + __gnu_parallel:: + replace_if_selector<RandomAccessIterator, Predicate, T> + functionality(new_value); + __gnu_parallel:: + for_each_template_random_access(begin, end, pred, + functionality, + __gnu_parallel::dummy_reduct(), + true, dummy, -1, parallelism_tag); + } else - replace_if(begin, end, pred, new_value, - __gnu_parallel::sequential_tag()); + replace_if(begin, end, pred, new_value, + __gnu_parallel::sequential_tag()); } // Public interface. template<typename ForwardIterator, typename Predicate, typename T> inline void replace_if(ForwardIterator begin, ForwardIterator end, - Predicate pred, const T& new_value, - __gnu_parallel::_Parallelism parallelism_tag) + Predicate pred, const T& new_value, + __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<ForwardIterator> iterator_traits; typedef typename iterator_traits::iterator_category iterator_category; replace_if_switch(begin, end, pred, new_value, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename ForwardIterator, typename Predicate, typename T> inline void replace_if(ForwardIterator begin, ForwardIterator end, - Predicate pred, const T& new_value) + Predicate pred, const T& new_value) { typedef std::iterator_traits<ForwardIterator> iterator_traits; typedef typename iterator_traits::iterator_category iterator_category; @@ -1512,46 +1514,46 @@ namespace __parallel template<typename ForwardIterator, typename Generator> inline void generate(ForwardIterator begin, ForwardIterator end, Generator gen, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::generate(begin, end, gen); } // Sequential fallback for input iterator case. template<typename ForwardIterator, typename Generator, typename IteratorTag> inline void generate_switch(ForwardIterator begin, ForwardIterator end, Generator gen, - IteratorTag) + IteratorTag) { generate(begin, end, gen, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename RandomAccessIterator, typename Generator> void generate_switch(RandomAccessIterator begin, RandomAccessIterator end, - Generator gen, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + Generator gen, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().generate_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - bool dummy; - __gnu_parallel::generate_selector<RandomAccessIterator> - functionality; - __gnu_parallel:: - for_each_template_random_access(begin, end, gen, functionality, - __gnu_parallel::dummy_reduct(), - true, dummy, -1, parallelism_tag); - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().generate_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + bool dummy; + __gnu_parallel::generate_selector<RandomAccessIterator> + functionality; + __gnu_parallel:: + for_each_template_random_access(begin, end, gen, functionality, + __gnu_parallel::dummy_reduct(), + true, dummy, -1, parallelism_tag); + } else - generate(begin, end, gen, __gnu_parallel::sequential_tag()); + generate(begin, end, gen, __gnu_parallel::sequential_tag()); } // Public interface. template<typename ForwardIterator, typename Generator> inline void generate(ForwardIterator begin, ForwardIterator end, - Generator gen, __gnu_parallel::_Parallelism parallelism_tag) + Generator gen, __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<ForwardIterator> iterator_traits; typedef typename iterator_traits::iterator_category iterator_category; @@ -1572,12 +1574,12 @@ namespace __parallel template<typename OutputIterator, typename Size, typename Generator> inline OutputIterator generate_n(OutputIterator begin, Size n, Generator gen, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::generate_n(begin, n, gen); } // Sequential fallback for input iterator case. template<typename OutputIterator, typename Size, typename Generator, - typename IteratorTag> + typename IteratorTag> inline OutputIterator generate_n_switch(OutputIterator begin, Size n, Generator gen, IteratorTag) { return generate_n(begin, n, gen, __gnu_parallel::sequential_tag()); } @@ -1586,9 +1588,9 @@ namespace __parallel template<typename RandomAccessIterator, typename Size, typename Generator> inline RandomAccessIterator generate_n_switch(RandomAccessIterator begin, Size n, Generator gen, - random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { // XXX parallel version is where? return generate_n(begin, n, gen, __gnu_parallel::sequential_tag()); @@ -1598,12 +1600,12 @@ namespace __parallel template<typename OutputIterator, typename Size, typename Generator> inline OutputIterator generate_n(OutputIterator begin, Size n, Generator gen, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef std::iterator_traits<OutputIterator> iterator_traits; typedef typename iterator_traits::iterator_category iterator_category; return generate_n_switch(begin, n, gen, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename OutputIterator, typename Size, typename Generator> @@ -1620,14 +1622,14 @@ namespace __parallel template<typename RandomAccessIterator> inline void random_shuffle(RandomAccessIterator begin, RandomAccessIterator end, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::random_shuffle(begin, end); } // Sequential fallback. template<typename RandomAccessIterator, typename RandomNumberGenerator> inline void random_shuffle(RandomAccessIterator begin, RandomAccessIterator end, - RandomNumberGenerator& rand, __gnu_parallel::sequential_tag) + RandomNumberGenerator& rand, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::random_shuffle(begin, end, rand); } @@ -1654,51 +1656,51 @@ namespace __parallel template<typename RandomAccessIterator, typename RandomNumberGenerator> void random_shuffle(RandomAccessIterator begin, RandomAccessIterator end, - RandomNumberGenerator& rand) + RandomNumberGenerator& rand) { if (begin == end) - return; + return; if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().random_shuffle_minimal_n)) - __gnu_parallel::parallel_random_shuffle(begin, end, rand); + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().random_shuffle_minimal_n)) + __gnu_parallel::parallel_random_shuffle(begin, end, rand); else - __gnu_parallel::sequential_random_shuffle(begin, end, rand); + __gnu_parallel::sequential_random_shuffle(begin, end, rand); } // Sequential fallback. template<typename ForwardIterator, typename Predicate> inline ForwardIterator partition(ForwardIterator begin, ForwardIterator end, - Predicate pred, __gnu_parallel::sequential_tag) + Predicate pred, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::partition(begin, end, pred); } // Sequential fallback for input iterator case. template<typename ForwardIterator, typename Predicate, typename IteratorTag> inline ForwardIterator partition_switch(ForwardIterator begin, ForwardIterator end, - Predicate pred, IteratorTag) + Predicate pred, IteratorTag) { return partition(begin, end, pred, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators. template<typename RandomAccessIterator, typename Predicate> RandomAccessIterator partition_switch(RandomAccessIterator begin, RandomAccessIterator end, - Predicate pred, random_access_iterator_tag) + Predicate pred, random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().partition_minimal_n)) - { - typedef typename std::iterator_traits<RandomAccessIterator>:: - difference_type difference_type; - difference_type middle = __gnu_parallel:: - parallel_partition(begin, end, pred, - __gnu_parallel::get_max_threads()); - return begin + middle; - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().partition_minimal_n)) + { + typedef typename std::iterator_traits<RandomAccessIterator>:: + difference_type difference_type; + difference_type middle = __gnu_parallel:: + parallel_partition(begin, end, pred, + __gnu_parallel::get_max_threads()); + return begin + middle; + } else - return partition(begin, end, pred, __gnu_parallel::sequential_tag()); + return partition(begin, end, pred, __gnu_parallel::sequential_tag()); } // Public interface. @@ -1711,20 +1713,43 @@ namespace __parallel return partition_switch(begin, end, pred, iterator_category()); } + // sort interface + // Sequential fallback template<typename RandomAccessIterator> inline void sort(RandomAccessIterator begin, RandomAccessIterator end, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::sort(begin, end); } // Sequential fallback template<typename RandomAccessIterator, typename Comparator> inline void sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::sort<RandomAccessIterator, Comparator>(begin, end, - comp); } + comp); } + + // Public interface + template<typename RandomAccessIterator, typename Comparator, + typename Parallelism> + void + sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp, + Parallelism parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + + if (begin != end) + { + if (_GLIBCXX_PARALLEL_CONDITION( + static_cast<__gnu_parallel::sequence_index_t>(end - begin) >= + __gnu_parallel::_Settings::get().sort_minimal_n)) + __gnu_parallel::parallel_sort<false>(begin, end, comp, parallelism); + else + sort(begin, end, comp, __gnu_parallel::sequential_tag()); + } + } // Public interface, insert default comparator template<typename RandomAccessIterator> @@ -1733,128 +1758,317 @@ namespace __parallel { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; - sort(begin, end, std::less<value_type>()); + sort(begin, end, std::less<value_type>(), + __gnu_parallel::default_parallel_tag()); } + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::default_parallel_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::parallel_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::multiway_mergesort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::multiway_mergesort_sampling_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::multiway_mergesort_exact_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::quicksort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::balanced_quicksort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface template<typename RandomAccessIterator, typename Comparator> void sort(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; + sort(begin, end, comp, __gnu_parallel::default_parallel_tag()); + } - if (begin != end) - { - if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().sort_minimal_n)) - __gnu_parallel::parallel_sort(begin, end, comp, false); - else - sort(begin, end, comp, __gnu_parallel::sequential_tag()); - } - } - // Sequential fallback. + // stable_sort interface + + + // Sequential fallback template<typename RandomAccessIterator> - inline void - stable_sort(RandomAccessIterator begin, RandomAccessIterator end, - __gnu_parallel::sequential_tag) - { return _GLIBCXX_STD_P::stable_sort(begin, end); } + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::sequential_tag) + { _GLIBCXX_STD_P::stable_sort(begin, end); } - // Sequential fallback. + // Sequential fallback template<typename RandomAccessIterator, typename Comparator> - inline void - stable_sort(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, __gnu_parallel::sequential_tag) - { return _GLIBCXX_STD_P::stable_sort(begin, end, comp); } + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, __gnu_parallel::sequential_tag) + { _GLIBCXX_STD_P::stable_sort<RandomAccessIterator, Comparator>( + begin, end, comp); } + + // Public interface + template<typename RandomAccessIterator, typename Comparator, + typename Parallelism> + void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, Parallelism parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + + if (begin != end) + { + if (_GLIBCXX_PARALLEL_CONDITION( + static_cast<__gnu_parallel::sequence_index_t>(end - begin) >= + __gnu_parallel::_Settings::get().sort_minimal_n)) + __gnu_parallel::parallel_sort<true>(begin, end, comp, parallelism); + else + stable_sort(begin, end, comp, __gnu_parallel::sequential_tag()); + } + } + // Public interface, insert default comparator template<typename RandomAccessIterator> - inline void - stable_sort(RandomAccessIterator begin, RandomAccessIterator end) - { - typedef iterator_traits<RandomAccessIterator> traits_type; - typedef typename traits_type::value_type value_type; - stable_sort(begin, end, std::less<value_type>()); - } + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), + __gnu_parallel::default_parallel_tag()); + } - // Parallel algorithm for random access iterators + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::default_parallel_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::parallel_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::multiway_mergesort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::quicksort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface, insert default comparator + template<typename RandomAccessIterator> + inline void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + __gnu_parallel::balanced_quicksort_tag parallelism) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, std::less<value_type>(), parallelism); + } + + // Public interface template<typename RandomAccessIterator, typename Comparator> - void - stable_sort(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp) - { - if (begin != end) - { - if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().sort_minimal_n)) - __gnu_parallel::parallel_sort(begin, end, comp, true); - else - stable_sort(begin, end, comp, __gnu_parallel::sequential_tag()); - } - } + void + stable_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp) + { + typedef iterator_traits<RandomAccessIterator> traits_type; + typedef typename traits_type::value_type value_type; + stable_sort(begin, end, comp, __gnu_parallel::default_parallel_tag()); + } + + +// // Sequential fallback +// template<typename RandomAccessIterator> +// inline void +// stable_sort(RandomAccessIterator begin, RandomAccessIterator end, +// __gnu_parallel::sequential_tag) +// { return _GLIBCXX_STD_P::stable_sort(begin, end); } +// +// // Sequential fallback +// template<typename RandomAccessIterator, typename Comparator> +// inline void +// stable_sort(RandomAccessIterator begin, RandomAccessIterator end, +// Comparator comp, __gnu_parallel::sequential_tag) +// { return _GLIBCXX_STD_P::stable_sort(begin, end, comp); } +// +// template<typename RandomAccessIterator> +// void +// stable_sort(RandomAccessIterator begin, RandomAccessIterator end) +// { +// typedef iterator_traits<RandomAccessIterator> traits_type; +// typedef typename traits_type::value_type value_type; +// stable_sort(begin, end, std::less<value_type>()); +// } +// +// // Parallel algorithm for random access iterators +// template<typename RandomAccessIterator, typename Comparator> +// void +// stable_sort(RandomAccessIterator begin, RandomAccessIterator end, +// Comparator comp) +// { +// if (begin != end) +// { +// if (_GLIBCXX_PARALLEL_CONDITION( +// static_cast<__gnu_parallel::sequence_index_t>(end - begin) >= +// __gnu_parallel::_Settings::get().sort_minimal_n)) +// __gnu_parallel::parallel_sort(begin, end, comp, +// __gnu_parallel::parallel_tag()); +// else +// stable_sort(begin, end, comp, __gnu_parallel::sequential_tag()); +// } +// } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, - InputIterator2 end2, OutputIterator result, - __gnu_parallel::sequential_tag) + InputIterator2 end2, OutputIterator result, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2, result); } // Sequential fallback template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Comparator> + typename OutputIterator, typename Comparator> inline OutputIterator merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, - InputIterator2 end2, OutputIterator result, Comparator comp, - __gnu_parallel::sequential_tag) + InputIterator2 end2, OutputIterator result, Comparator comp, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2, result, comp); } // Sequential fallback for input iterator case template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Comparator, - typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> + typename OutputIterator, typename Comparator, + typename IteratorTag1, typename IteratorTag2, typename IteratorTag3> inline OutputIterator merge_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator result, Comparator comp, - IteratorTag1, IteratorTag2, IteratorTag3) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator result, Comparator comp, + IteratorTag1, IteratorTag2, IteratorTag3) { return _GLIBCXX_STD_P::merge(begin1, end1, begin2, end2, - result, comp); } + result, comp); } // Parallel algorithm for random access iterators template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Comparator> + typename OutputIterator, typename Comparator> OutputIterator merge_switch(InputIterator1 begin1, InputIterator1 end1, - InputIterator2 begin2, InputIterator2 end2, - OutputIterator result, Comparator comp, - random_access_iterator_tag, random_access_iterator_tag, - random_access_iterator_tag) + InputIterator2 begin2, InputIterator2 end2, + OutputIterator result, Comparator comp, + random_access_iterator_tag, random_access_iterator_tag, + random_access_iterator_tag) { if (_GLIBCXX_PARALLEL_CONDITION( - (static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) - >= __gnu_parallel::_Settings::get().merge_minimal_n - || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) - >= __gnu_parallel::_Settings::get().merge_minimal_n))) - return __gnu_parallel::parallel_merge_advance(begin1, end1, - begin2, end2, - result, (end1 - begin1) - + (end2 - begin2), comp); + (static_cast<__gnu_parallel::sequence_index_t>(end1 - begin1) + >= __gnu_parallel::_Settings::get().merge_minimal_n + || static_cast<__gnu_parallel::sequence_index_t>(end2 - begin2) + >= __gnu_parallel::_Settings::get().merge_minimal_n))) + return __gnu_parallel::parallel_merge_advance(begin1, end1, + begin2, end2, + result, (end1 - begin1) + + (end2 - begin2), comp); else - return __gnu_parallel::merge_advance(begin1, end1, begin2, end2, - result, (end1 - begin1) - + (end2 - begin2), comp); + return __gnu_parallel::merge_advance(begin1, end1, begin2, end2, + result, (end1 - begin1) + + (end2 - begin2), comp); } // Public interface template<typename InputIterator1, typename InputIterator2, - typename OutputIterator, typename Comparator> + typename OutputIterator, typename Comparator> inline OutputIterator merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, - InputIterator2 end2, OutputIterator result, Comparator comp) + InputIterator2 end2, OutputIterator result, Comparator comp) { typedef typename iterator_traits<InputIterator1>::value_type value_type; @@ -1862,23 +2076,23 @@ namespace __parallel typedef std::iterator_traits<InputIterator2> iteratori2_traits; typedef std::iterator_traits<OutputIterator> iteratoro_traits; typedef typename iteratori1_traits::iterator_category - iteratori1_category; + iteratori1_category; typedef typename iteratori2_traits::iterator_category - iteratori2_category; + iteratori2_category; typedef typename iteratoro_traits::iterator_category iteratoro_category; return merge_switch(begin1, end1, begin2, end2, result, comp, - iteratori1_category(), iteratori2_category(), - iteratoro_category()); + iteratori1_category(), iteratori2_category(), + iteratoro_category()); } // Public interface, insert default comparator template<typename InputIterator1, typename InputIterator2, - typename OutputIterator> + typename OutputIterator> inline OutputIterator merge(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, - InputIterator2 end2, OutputIterator result) + InputIterator2 end2, OutputIterator result) { typedef std::iterator_traits<InputIterator1> iterator1_traits; typedef std::iterator_traits<InputIterator2> iterator2_traits; @@ -1886,43 +2100,43 @@ namespace __parallel typedef typename iterator2_traits::value_type value2_type; return merge(begin1, end1, begin2, end2, result, - __gnu_parallel::less<value1_type, value2_type>()); + __gnu_parallel::less<value1_type, value2_type>()); } // Sequential fallback template<typename RandomAccessIterator> inline void nth_element(RandomAccessIterator begin, RandomAccessIterator nth, - RandomAccessIterator end, __gnu_parallel::sequential_tag) + RandomAccessIterator end, __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::nth_element(begin, nth, end); } // Sequential fallback template<typename RandomAccessIterator, typename Comparator> inline void nth_element(RandomAccessIterator begin, RandomAccessIterator nth, - RandomAccessIterator end, Comparator comp, - __gnu_parallel::sequential_tag) + RandomAccessIterator end, Comparator comp, + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::nth_element(begin, nth, end, comp); } // Public interface template<typename RandomAccessIterator, typename Comparator> inline void nth_element(RandomAccessIterator begin, RandomAccessIterator nth, - RandomAccessIterator end, Comparator comp) + RandomAccessIterator end, Comparator comp) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().nth_element_minimal_n)) - __gnu_parallel::parallel_nth_element(begin, nth, end, comp); + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().nth_element_minimal_n)) + __gnu_parallel::parallel_nth_element(begin, nth, end, comp); else - nth_element(begin, nth, end, comp, __gnu_parallel::sequential_tag()); + nth_element(begin, nth, end, comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename RandomAccessIterator> inline void nth_element(RandomAccessIterator begin, RandomAccessIterator nth, - RandomAccessIterator end) + RandomAccessIterator end) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; @@ -1933,37 +2147,37 @@ namespace __parallel template<typename RandomAccessIterator, typename _Compare> inline void partial_sort(RandomAccessIterator begin, RandomAccessIterator middle, - RandomAccessIterator end, _Compare comp, - __gnu_parallel::sequential_tag) + RandomAccessIterator end, _Compare comp, + __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::partial_sort(begin, middle, end, comp); } // Sequential fallback template<typename RandomAccessIterator> inline void partial_sort(RandomAccessIterator begin, RandomAccessIterator middle, - RandomAccessIterator end, __gnu_parallel::sequential_tag) + RandomAccessIterator end, __gnu_parallel::sequential_tag) { _GLIBCXX_STD_P::partial_sort(begin, middle, end); } // Public interface, parallel algorithm for random access iterators template<typename RandomAccessIterator, typename _Compare> void partial_sort(RandomAccessIterator begin, RandomAccessIterator middle, - RandomAccessIterator end, _Compare comp) + RandomAccessIterator end, _Compare comp) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().partial_sort_minimal_n)) - __gnu_parallel::parallel_partial_sort(begin, middle, end, comp); + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().partial_sort_minimal_n)) + __gnu_parallel::parallel_partial_sort(begin, middle, end, comp); else - partial_sort(begin, middle, end, comp, - __gnu_parallel::sequential_tag()); + partial_sort(begin, middle, end, comp, + __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename RandomAccessIterator> inline void partial_sort(RandomAccessIterator begin, RandomAccessIterator middle, - RandomAccessIterator end) + RandomAccessIterator end) { typedef iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; @@ -1974,58 +2188,58 @@ namespace __parallel template<typename ForwardIterator> inline ForwardIterator max_element(ForwardIterator begin, ForwardIterator end, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::max_element(begin, end); } // Sequential fallback template<typename ForwardIterator, typename Comparator> inline ForwardIterator max_element(ForwardIterator begin, ForwardIterator end, Comparator comp, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::max_element(begin, end, comp); } // Sequential fallback for input iterator case template<typename ForwardIterator, typename Comparator, typename IteratorTag> inline ForwardIterator max_element_switch(ForwardIterator begin, ForwardIterator end, - Comparator comp, IteratorTag) + Comparator comp, IteratorTag) { return max_element(begin, end, comp, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator, typename Comparator> RandomAccessIterator max_element_switch(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + Comparator comp, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().max_element_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - RandomAccessIterator res(begin); - __gnu_parallel::identity_selector<RandomAccessIterator> - functionality; - __gnu_parallel:: - for_each_template_random_access(begin, end, - __gnu_parallel::nothing(), - functionality, - __gnu_parallel:: - max_element_reduct<Comparator, - RandomAccessIterator>(comp), - res, res, -1, parallelism_tag); - return res; - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().max_element_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + RandomAccessIterator res(begin); + __gnu_parallel::identity_selector<RandomAccessIterator> + functionality; + __gnu_parallel:: + for_each_template_random_access(begin, end, + __gnu_parallel::nothing(), + functionality, + __gnu_parallel:: + max_element_reduct<Comparator, + RandomAccessIterator>(comp), + res, res, -1, parallelism_tag); + return res; + } else - return max_element(begin, end, comp, __gnu_parallel::sequential_tag()); + return max_element(begin, end, comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename ForwardIterator> inline ForwardIterator max_element(ForwardIterator begin, ForwardIterator end, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef typename iterator_traits<ForwardIterator>::value_type value_type; return max_element(begin, end, std::less<value_type>(), parallelism_tag); @@ -2043,12 +2257,12 @@ namespace __parallel template<typename ForwardIterator, typename Comparator> inline ForwardIterator max_element(ForwardIterator begin, ForwardIterator end, Comparator comp, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef iterator_traits<ForwardIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; return max_element_switch(begin, end, comp, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename ForwardIterator, typename Comparator> @@ -2065,58 +2279,58 @@ namespace __parallel template<typename ForwardIterator> inline ForwardIterator min_element(ForwardIterator begin, ForwardIterator end, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::min_element(begin, end); } // Sequential fallback template<typename ForwardIterator, typename Comparator> inline ForwardIterator min_element(ForwardIterator begin, ForwardIterator end, Comparator comp, - __gnu_parallel::sequential_tag) + __gnu_parallel::sequential_tag) { return _GLIBCXX_STD_P::min_element(begin, end, comp); } // Sequential fallback for input iterator case template<typename ForwardIterator, typename Comparator, typename IteratorTag> inline ForwardIterator min_element_switch(ForwardIterator begin, ForwardIterator end, - Comparator comp, IteratorTag) + Comparator comp, IteratorTag) { return min_element(begin, end, comp, __gnu_parallel::sequential_tag()); } // Parallel algorithm for random access iterators template<typename RandomAccessIterator, typename Comparator> RandomAccessIterator min_element_switch(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, random_access_iterator_tag, - __gnu_parallel::_Parallelism parallelism_tag - = __gnu_parallel::parallel_balanced) + Comparator comp, random_access_iterator_tag, + __gnu_parallel::_Parallelism parallelism_tag + = __gnu_parallel::parallel_balanced) { if (_GLIBCXX_PARALLEL_CONDITION( - static_cast<__gnu_parallel::sequence_index_t>(end - begin) - >= __gnu_parallel::_Settings::get().min_element_minimal_n - && __gnu_parallel::is_parallel(parallelism_tag))) - { - RandomAccessIterator res(begin); - __gnu_parallel::identity_selector<RandomAccessIterator> - functionality; - __gnu_parallel:: - for_each_template_random_access(begin, end, - __gnu_parallel::nothing(), - functionality, - __gnu_parallel:: - min_element_reduct<Comparator, - RandomAccessIterator>(comp), - res, res, -1, parallelism_tag); - return res; - } + static_cast<__gnu_parallel::sequence_index_t>(end - begin) + >= __gnu_parallel::_Settings::get().min_element_minimal_n + && __gnu_parallel::is_parallel(parallelism_tag))) + { + RandomAccessIterator res(begin); + __gnu_parallel::identity_selector<RandomAccessIterator> + functionality; + __gnu_parallel:: + for_each_template_random_access(begin, end, + __gnu_parallel::nothing(), + functionality, + __gnu_parallel:: + min_element_reduct<Comparator, + RandomAccessIterator>(comp), + res, res, -1, parallelism_tag); + return res; + } else - return min_element(begin, end, comp, __gnu_parallel::sequential_tag()); + return min_element(begin, end, comp, __gnu_parallel::sequential_tag()); } // Public interface, insert default comparator template<typename ForwardIterator> inline ForwardIterator min_element(ForwardIterator begin, ForwardIterator end, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef typename iterator_traits<ForwardIterator>::value_type value_type; return min_element(begin, end, std::less<value_type>(), parallelism_tag); @@ -2134,12 +2348,12 @@ namespace __parallel template<typename ForwardIterator, typename Comparator> inline ForwardIterator min_element(ForwardIterator begin, ForwardIterator end, Comparator comp, - __gnu_parallel::_Parallelism parallelism_tag) + __gnu_parallel::_Parallelism parallelism_tag) { typedef iterator_traits<ForwardIterator> traits_type; typedef typename traits_type::iterator_category iterator_category; return min_element_switch(begin, end, comp, iterator_category(), - parallelism_tag); + parallelism_tag); } template<typename ForwardIterator, typename Comparator> diff --git a/libstdc++-v3/include/parallel/balanced_quicksort.h b/libstdc++-v3/include/parallel/balanced_quicksort.h index f6b3297cb45..d94cf332a73 100644 --- a/libstdc++-v3/include/parallel/balanced_quicksort.h +++ b/libstdc++-v3/include/parallel/balanced_quicksort.h @@ -252,7 +252,8 @@ template<typename RandomAccessIterator, typename Comparator> QSBThreadLocal<RandomAccessIterator>& tl = *tls[iam]; - difference_type base_case_n = _Settings::get().sort_qsb_base_case_maximal_n; + difference_type base_case_n = + _Settings::get().sort_qsb_base_case_maximal_n; if (base_case_n < 2) base_case_n = 2; thread_index_t num_threads = tl.num_threads; @@ -415,7 +416,6 @@ template<typename RandomAccessIterator, typename Comparator> * @param begin Begin iterator of sequence. * @param end End iterator of sequence. * @param comp Comparator. - * @param n Length of the sequence to sort. * @param num_threads Number of threads that are allowed to work on * this part. */ @@ -423,8 +423,6 @@ template<typename RandomAccessIterator, typename Comparator> void parallel_sort_qsb(RandomAccessIterator begin, RandomAccessIterator end, Comparator comp, - typename std::iterator_traits<RandomAccessIterator> - ::difference_type n, thread_index_t num_threads) { _GLIBCXX_CALL(end - begin) @@ -436,6 +434,8 @@ template<typename RandomAccessIterator, typename Comparator> typedef QSBThreadLocal<RandomAccessIterator> tls_type; + difference_type n = end - begin; + if (n <= 1) return; diff --git a/libstdc++-v3/include/parallel/merge.h b/libstdc++-v3/include/parallel/merge.h index 6e0f2e382c3..cabd5bd4de2 100644 --- a/libstdc++-v3/include/parallel/merge.h +++ b/libstdc++-v3/include/parallel/merge.h @@ -248,7 +248,7 @@ namespace __gnu_parallel typedef typename std::pair<RandomAccessIterator1, RandomAccessIterator1> iterator_pair; - std::pair<RandomAccessIterator1, RandomAccessIterator1> + iterator_pair seqs[2] = { std::make_pair(begin1, end1), std::make_pair(begin2, end2) }; RandomAccessIterator3 diff --git a/libstdc++-v3/include/parallel/multiseq_selection.h b/libstdc++-v3/include/parallel/multiseq_selection.h index 839cc4d5c1d..662204526c9 100644 --- a/libstdc++-v3/include/parallel/multiseq_selection.h +++ b/libstdc++-v3/include/parallel/multiseq_selection.h @@ -124,22 +124,22 @@ namespace __gnu_parallel * @param comp The ordering functor, defaults to std::less<T>. */ template<typename RanSeqs, typename RankType, typename RankIterator, - typename Comparator> + typename Comparator> void multiseq_partition(RanSeqs begin_seqs, RanSeqs end_seqs, - RankType rank, - RankIterator begin_offsets, - Comparator comp = std::less< - typename std::iterator_traits<typename - std::iterator_traits<RanSeqs>::value_type:: - first_type>::value_type>()) // std::less<T> + RankType rank, + RankIterator begin_offsets, + Comparator comp = std::less< + typename std::iterator_traits<typename + std::iterator_traits<RanSeqs>::value_type:: + first_type>::value_type>()) // std::less<T> { _GLIBCXX_CALL(end_seqs - begin_seqs) typedef typename std::iterator_traits<RanSeqs>::value_type::first_type - It; + It; typedef typename std::iterator_traits<It>::difference_type - difference_type; + difference_type; typedef typename std::iterator_traits<It>::value_type value_type; lexicographic<value_type, int, Comparator> lcomp(comp); @@ -148,19 +148,27 @@ namespace __gnu_parallel // Number of sequences, number of elements in total (possibly // including padding). difference_type m = std::distance(begin_seqs, end_seqs), N = 0, - nmax, n, r; + nmax, n, r; for (int i = 0; i < m; i++) - N += std::distance(begin_seqs[i].first, begin_seqs[i].second); + { + N += std::distance(begin_seqs[i].first, begin_seqs[i].second); + _GLIBCXX_PARALLEL_ASSERT( + std::distance(begin_seqs[i].first, begin_seqs[i].second) > 0); + } if (rank == N) - { - for (int i = 0; i < m; i++) - begin_offsets[i] = begin_seqs[i].second; // Very end. - // Return m - 1; - } - - _GLIBCXX_PARALLEL_ASSERT(m != 0 && N != 0 && rank >= 0 && rank < N); + { + for (int i = 0; i < m; i++) + begin_offsets[i] = begin_seqs[i].second; // Very end. + // Return m - 1; + return; + } + + _GLIBCXX_PARALLEL_ASSERT(m != 0); + _GLIBCXX_PARALLEL_ASSERT(N != 0); + _GLIBCXX_PARALLEL_ASSERT(rank >= 0); + _GLIBCXX_PARALLEL_ASSERT(rank < N); difference_type* ns = new difference_type[m]; difference_type* a = new difference_type[m]; diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h index 40a2f1bc6af..0505722c8a4 100644 --- a/libstdc++-v3/include/parallel/multiway_merge.h +++ b/libstdc++-v3/include/parallel/multiway_merge.h @@ -282,7 +282,8 @@ template<typename RandomAccessIterator, typename Comparator> * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, less equal than the + * total number of elements available. * * @return End iterator of output sequence. */ @@ -401,7 +402,8 @@ template<template<typename RAI, typename C> class iterator, * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, less equal than the + * total number of elements available. * * @return End iterator of output sequence. */ @@ -518,11 +520,14 @@ template<template<typename RAI, typename C> class iterator, * * Stability is selected through the used LoserTree class <tt>LT</tt>. * + * At least one non-empty sequence is required. + * * @param seqs_begin Begin iterator of iterator pair input sequence. * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, less equal than the + * total number of elements available. * * @return End iterator of output sequence. */ @@ -551,22 +556,16 @@ template<typename LT, LT lt(k, comp); - difference_type total_length = 0; - // Default value for potentially non-default-constructible types. value_type* arbitrary_element = NULL; for (int t = 0; t < k; ++t) { if(arbitrary_element == NULL - && _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]) > 0) + && _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]) > 0) arbitrary_element = &(*seqs_begin[t].first); - total_length += _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]); } - if(total_length == 0) - return target; - for (int t = 0; t < k; ++t) { if (seqs_begin[t].first == seqs_begin[t].second) @@ -577,11 +576,9 @@ template<typename LT, lt.init(); - const difference_type const_total_length(std::min(total_length, length)); - int source; - for (difference_type i = 0; i < const_total_length; ++i) + for (difference_type i = 0; i < length; ++i) { //take out source = lt.get_min_source(); @@ -612,7 +609,8 @@ template<typename LT, * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, less equal than the + * total number of elements available. * * @return End iterator of output sequence. */ @@ -644,23 +642,16 @@ template<typename LT, LT lt(k, sentinel, comp); - difference_type total_length = 0; - for (int t = 0; t < k; ++t) { #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(seqs_begin[t].first != seqs_begin[t].second); #endif lt.insert_start(*seqs_begin[t].first, t, false); - - total_length += _GLIBCXX_PARALLEL_LENGTH(seqs_begin[t]); } lt.init(); - // Do not go past end. - length = std::min(total_length, length); - int source; #if _GLIBCXX_ASSERTIONS @@ -698,6 +689,7 @@ template<typename LT, /** @brief Multi-way merging procedure for a high branching factor, * requiring sentinels to exist. + * * @param stable The value must the same as for the used LoserTrees. * @param UnguardedLoserTree Loser Tree variant to use for the unguarded * merging. @@ -708,7 +700,8 @@ template<typename LT, * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, less equal than the + * total number of elements available. * * @return End iterator of output sequence. */ @@ -737,23 +730,16 @@ template< RandomAccessIterator3 target_end; - difference_type total_length = 0; for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - { - total_length += _GLIBCXX_PARALLEL_LENGTH(*s); - - // Move the sequends end behind the sentinel spots. This has the - // effect that the sentinel appears to be within the sequence. Then, - // we can use the unguarded variant if we merge out as many - // non-sentinel elements as we have. - ++((*s).second); - } + // Move the sequends end behind the sentinel spots. This has the + // effect that the sentinel appears to be within the sequence. Then, + // we can use the unguarded variant if we merge out as many + // non-sentinel elements as we have. + ++((*s).second); - difference_type unguarded_length = - std::min(length, total_length); target_end = multiway_merge_loser_tree_unguarded <UnguardedLoserTree> - (seqs_begin, seqs_end, target, 0, comp, unguarded_length); + (seqs_begin, seqs_end, target, 0, comp, length); #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(target_end == target + length); @@ -763,7 +749,7 @@ template< // Restore the sequence ends so the sentinels are not contained in the // sequence any more (see comment in loop above). for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) - { --((*s).second); } + --((*s).second); return target_end; } @@ -977,7 +963,8 @@ struct multiway_merge_k_variant_sentinel_switch * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, possibly larger than the + * number of elements available. * @param stable Stable merging incurs a performance penalty. * @param sentinel The sequences have a sentinel element. * @return End iterator of output sequence. */ @@ -1010,7 +997,16 @@ template< } #endif - RandomAccessIterator3 return_target = target; + _DifferenceTp total_length = 0; + for (RandomAccessIteratorIterator s = seqs_begin; s != seqs_end; ++s) + total_length += _GLIBCXX_PARALLEL_LENGTH(*s); + + length = std::min<_DifferenceTp>(length, total_length); + + if(length == 0) + return target; + + RandomAccessIterator3 return_target = target; int k = static_cast<int>(seqs_end - seqs_begin); switch (k) @@ -1079,7 +1075,7 @@ struct sampling_sorter /** * @brief Non-stable sorting functor. * - * Used to reduce code instanciation in multiway_merge_sampling_splitting. + * Used to reduce code instantiation in multiway_merge_sampling_splitting. */ template<class RandomAccessIterator, class StrictWeakOrdering> struct sampling_sorter<false, RandomAccessIterator, StrictWeakOrdering> @@ -1126,11 +1122,11 @@ void multiway_merge_sampling_splitting( { difference_type sample_index = static_cast<difference_type>( - _GLIBCXX_PARALLEL_LENGTH(seqs_begin[s]) * (double(i + 1) / - (num_samples + 1)) * (double(length) - / total_length)); - new(&(samples[s * num_samples + i])) value_type( - seqs_begin[s].first[sample_index]); + _GLIBCXX_PARALLEL_LENGTH(seqs_begin[s]) + * (double(i + 1) / (num_samples + 1)) + * (double(length) / total_length)); + new(&(samples[s * num_samples + i])) + value_type(seqs_begin[s].first[sample_index]); } // Sort stable or non-stable, depending on value of template parameter @@ -1152,10 +1148,8 @@ void multiway_merge_sampling_splitting( comp) - seqs_begin[seq].first; else - { - // Absolute beginning. - pieces[slab][seq].first = 0; - } + // Absolute beginning. + pieces[slab][seq].first = 0; if ((slab + 1) < num_threads) pieces[slab][seq].second = std::upper_bound( @@ -1165,13 +1159,16 @@ void multiway_merge_sampling_splitting( num_threads], comp) - seqs_begin[seq].first; else - pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); + // Absolute end. + pieces[slab][seq].second = _GLIBCXX_PARALLEL_LENGTH(seqs_begin[seq]); } ::operator delete(samples); } /** * @brief Exact splitting for parallel multiway-merge routine. + * + * None of the passed sequences may be empty. */ template< bool stable @@ -1269,7 +1266,8 @@ void multiway_merge_exact_splitting( * @param seqs_end End iterator of iterator pair input sequence. * @param target Begin iterator out output sequence. * @param comp Comparator. - * @param length Maximum length to merge. + * @param length Maximum length to merge, possibly larger than the + * number of elements available. * @param stable Stable merging incurs a performance penalty. * @param sentinel Ignored. * @return End iterator of output sequence. @@ -1304,23 +1302,41 @@ template< typedef typename std::iterator_traits<RandomAccessIterator1>::value_type value_type; - // k sequences. - int k = static_cast<int>(seqs_end - seqs_begin); - + // Leave only non-empty sequences. + std::pair<RandomAccessIterator1, RandomAccessIterator1>* ne_seqs = + static_cast<std::pair<RandomAccessIterator1, RandomAccessIterator1>*>( + ::operator new( + sizeof(std::pair<RandomAccessIterator1, RandomAccessIterator1>) + * (seqs_end - seqs_begin))); + int k = 0; difference_type total_length = 0; for (RandomAccessIteratorIterator raii = seqs_begin; raii != seqs_end; ++raii) - total_length += _GLIBCXX_PARALLEL_LENGTH(*raii); + { + _DifferenceTp seq_length = _GLIBCXX_PARALLEL_LENGTH(*raii); + if(seq_length > 0) + { + total_length += seq_length; + //ne_seqs[k] = *raii; + new(&(ne_seqs[k++])) + std::pair<RandomAccessIterator1, RandomAccessIterator1>(*raii); + } + } _GLIBCXX_CALL(total_length) + length = std::min<_DifferenceTp>(length, total_length); + if (total_length == 0 || k == 0) + { + ::operator delete(ne_seqs); return target; + } std::vector<std::pair<difference_type, difference_type> >* pieces; - thread_index_t num_threads = static_cast<thread_index_t>( - std::min<difference_type>(get_max_threads(), total_length)); + thread_index_t num_threads = static_cast<thread_index_t> + (std::min<difference_type>(get_max_threads(), total_length)); # pragma omp parallel num_threads (num_threads) { @@ -1337,7 +1353,7 @@ template< __gnu_parallel::_Settings::get().merge_oversampling * num_threads; - splitter(seqs_begin, seqs_end, comp, length, total_length, + splitter(ne_seqs, ne_seqs + k, comp, length, total_length, pieces); } //single @@ -1348,50 +1364,37 @@ template< for (int c = 0; c < k; ++c) target_position += pieces[iam][c].first; - if (k > 2) - { - std::pair<RandomAccessIterator1, RandomAccessIterator1>* chunks - = new - std::pair<RandomAccessIterator1, RandomAccessIterator1>[k]; - - difference_type local_length = 0; - for (int s = 0; s < k; ++s) - { - chunks[s] = std::make_pair( - seqs_begin[s].first + pieces[iam][s].first, - seqs_begin[s].first + pieces[iam][s].second); - local_length += _GLIBCXX_PARALLEL_LENGTH(chunks[s]); - } - - sequential_multiway_merge<stable, sentinels>( - chunks, chunks + k, target + target_position, comp, - std::min(local_length, length - target_position)); - - delete[] chunks; - } - else if (k == 2) + std::pair<RandomAccessIterator1, RandomAccessIterator1>* chunks + = new std::pair<RandomAccessIterator1, RandomAccessIterator1>[k]; + + for (int s = 0; s < k; ++s) { - RandomAccessIterator1 - begin0 = seqs_begin[0].first + pieces[iam][0].first, - begin1 = seqs_begin[1].first + pieces[iam][1].first; - merge_advance(begin0, - seqs_begin[0].first + pieces[iam][0].second, - begin1, - seqs_begin[1].first + pieces[iam][1].second, - target + target_position, - (pieces[iam][0].second - pieces[iam][0].first) + - (pieces[iam][1].second - pieces[iam][1].first), - comp); + chunks[s] = std::make_pair( + ne_seqs[s].first + pieces[iam][s].first, + ne_seqs[s].first + pieces[iam][s].second); } + + if(length > target_position) + sequential_multiway_merge<stable, sentinels>( + chunks, chunks + k, target + target_position, comp, + length - target_position); + + delete[] chunks; } // parallel #if _GLIBCXX_ASSERTIONS _GLIBCXX_PARALLEL_ASSERT(is_sorted(target, target + length, comp)); #endif + k = 0; // Update ends of sequences. - for (int s = 0; s < k; ++s) - seqs_begin[s].first += pieces[num_threads - 1][s].second; + for (RandomAccessIteratorIterator raii = seqs_begin; + raii != seqs_end; ++raii) + { + _DifferenceTp length = _GLIBCXX_PARALLEL_LENGTH(*raii); + if(length > 0) + (*raii).first += pieces[num_threads - 1][k++].second; + } delete[] pieces; @@ -1430,12 +1433,12 @@ template< * for (int i = 0; i < 10; ++i) * for (int j = 0; i < 10; ++j) * sequences[i][j] = j; - * + * * int out[33]; * std::vector<std::pair<int*> > seqs; * for (int i = 0; i < 10; ++i) * { seqs.push(std::make_pair<int*>(sequences[i], sequences[i] + 10)) } - * + * * multiway_merge(seqs.begin(), seqs.end(), target, std::less<int>(), 33); * </pre> * @@ -1461,10 +1464,12 @@ template< * @param seqs_end end of sequence sequence * @param target target sequence to merge to. * @param comp strict weak ordering to use for element comparison. - * @param length the number of elements to merge into target. + * @param length Maximum length to merge, possibly larger than the + * number of elements available. * * @return end iterator of output sequence */ +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1486,28 +1491,26 @@ multiway_merge(RandomAccessIteratorPairIterator seqs_begin // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ false, /* sentinels = */ false> (seqs_begin, seqs_end, target, comp, multiway_merge_sampling_splitting</* stable = */ false, RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */false, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1533,6 +1536,7 @@ multiway_merge(RandomAccessIteratorPairIterator seqs_begin (seqs_begin, seqs_end, target, comp, length); } +//public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1555,14 +1559,13 @@ multiway_merge(RandomAccessIteratorPairIterator seqs_begin // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ false, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, @@ -1570,14 +1573,13 @@ multiway_merge(RandomAccessIteratorPairIterator seqs_begin RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */ false, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1599,14 +1601,13 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ true, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, @@ -1614,14 +1615,13 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin RandomAccessIteratorPairIterator, Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */ true, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1639,7 +1639,7 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute multiway merge *sequentially*. return sequential_multiway_merge @@ -1647,6 +1647,7 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin (seqs_begin, seqs_end, target, comp, length); } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1664,19 +1665,18 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ true, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, @@ -1685,12 +1685,10 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge</* stable = */ true, + return sequential_multiway_merge</* stable = */ true, /* sentinels = */ false>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } /** @@ -1706,7 +1704,7 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin * that breaks ties by sequence number but is slower. * * The first entries of the pairs (i.e. the begin iterators) will be moved - * forward. + * forward accordingly. * * The output sequence has to provide enough space for all elements * that are written to it. @@ -1763,10 +1761,12 @@ stable_multiway_merge(RandomAccessIteratorPairIterator seqs_begin * @param seqs_end end of sequence sequence * @param target target sequence to merge to. * @param comp strict weak ordering to use for element comparison. - * @param length the number of elements to merge into target. + * @param length Maximum length to merge, possibly larger than the + * number of elements available. * * @return end iterator of output sequence */ +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1783,19 +1783,18 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ false, /* sentinels = */ true> (seqs_begin, seqs_end, target, comp, multiway_merge_sampling_splitting @@ -1803,14 +1802,13 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */false, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +//public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1828,7 +1826,7 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute multiway merge *sequentially*. return sequential_multiway_merge @@ -1836,6 +1834,7 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin (seqs_begin, seqs_end, target, comp, length); } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1853,19 +1852,18 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ false, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, @@ -1874,14 +1872,13 @@ multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */ false, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1898,19 +1895,18 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ true, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, @@ -1919,14 +1915,13 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */ true, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1944,7 +1939,7 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute multiway merge *sequentially*. return sequential_multiway_merge @@ -1952,6 +1947,7 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin (seqs_begin, seqs_end, target, comp, length); } +// public interface template< typename RandomAccessIteratorPairIterator , typename RandomAccessIteratorOut @@ -1969,19 +1965,18 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin // catch special case: no sequences if (seqs_begin == seqs_end) - { return target; } + return target; // Execute merge; maybe parallel, depending on the number of merged // elements and the number of sequences and global thresholds in // Settings. - RandomAccessIteratorOut target_end; if ((seqs_end - seqs_begin > 1) && _GLIBCXX_PARALLEL_CONDITION( ((seqs_end - seqs_begin) >= __gnu_parallel::_Settings::get().multiway_merge_minimal_k) && ((sequence_index_t)length >= __gnu_parallel::_Settings::get().multiway_merge_minimal_n))) - target_end = parallel_multiway_merge + return parallel_multiway_merge </* stable = */ true, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, @@ -1990,12 +1985,10 @@ stable_multiway_merge_sentinels(RandomAccessIteratorPairIterator seqs_begin Comparator, _DifferenceTp>, static_cast<difference_type>(length)); else - target_end = sequential_multiway_merge + return sequential_multiway_merge </* stable = */ true, /* sentinels = */ true>( seqs_begin, seqs_end, target, comp, length); - - return target_end; } }; // namespace __gnu_parallel diff --git a/libstdc++-v3/include/parallel/quicksort.h b/libstdc++-v3/include/parallel/quicksort.h index de95549772a..8ef5b7c03c6 100644 --- a/libstdc++-v3/include/parallel/quicksort.h +++ b/libstdc++-v3/include/parallel/quicksort.h @@ -87,7 +87,8 @@ namespace __gnu_parallel __gnu_parallel::binder2nd<Comparator, value_type, value_type, bool> pred(comp, pivot); - difference_type split = parallel_partition(begin, end, pred, num_threads); + difference_type split = + parallel_partition(begin, end, pred, num_threads); ::operator delete(samples); @@ -154,7 +155,6 @@ namespace __gnu_parallel * @param begin Begin iterator of input sequence. * @param end End iterator input sequence, ignored. * @param comp Comparator. - * @param n Length of input sequence. * @param num_threads Number of threads that are allowed to work on * this part. */ @@ -162,9 +162,8 @@ namespace __gnu_parallel void parallel_sort_qs(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, typename std::iterator_traits - <RandomAccessIterator>::difference_type n, - int num_threads) + Comparator comp, + thread_index_t num_threads) { _GLIBCXX_CALL(n) @@ -172,12 +171,11 @@ namespace __gnu_parallel typedef typename traits_type::value_type value_type; typedef typename traits_type::difference_type difference_type; - if (n == 0) - return; + difference_type n = end - begin; // At least one element per processor. if (num_threads > n) - num_threads = static_cast<thread_index_t>(n); + num_threads = static_cast<thread_index_t>(n); // Hard to avoid. omp_set_num_threads(num_threads); diff --git a/libstdc++-v3/include/parallel/sort.h b/libstdc++-v3/include/parallel/sort.h index 83aa2df1b11..559ed1cc19e 100644 --- a/libstdc++-v3/include/parallel/sort.h +++ b/libstdc++-v3/include/parallel/sort.h @@ -60,7 +60,136 @@ namespace __gnu_parallel { + //prototype + template<bool stable, typename RandomAccessIterator, + typename Comparator, typename Parallelism> + void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, Parallelism parallelism); + /** + * @brief Choose multiway mergesort, splitting variant at run-time, + * for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, multiway_mergesort_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + if(_Settings::get().sort_splitting == EXACT) + parallel_sort_mwms<stable, true> + (begin, end, comp, parallelism.get_num_threads()); + else + parallel_sort_mwms<stable, false> + (begin, end, comp, parallelism.get_num_threads()); + } + + /** + * @brief Choose multiway mergesort with exact splitting, + * for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, multiway_mergesort_exact_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + parallel_sort_mwms<stable, true> + (begin, end, comp, parallelism.get_num_threads()); + } + + /** + * @brief Choose multiway mergesort with splitting by sampling, + * for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, multiway_mergesort_sampling_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + parallel_sort_mwms<stable, false> + (begin, end, comp, parallelism.get_num_threads()); + } + + /** + * @brief Choose quicksort for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, quicksort_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + _GLIBCXX_PARALLEL_ASSERT(stable == false); + + parallel_sort_qs(begin, end, comp, parallelism.get_num_threads()); + } + + /** + * @brief Choose balanced quicksort for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @param stable Sort stable. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, balanced_quicksort_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + _GLIBCXX_PARALLEL_ASSERT(stable == false); + + parallel_sort_qsb(begin, end, comp, parallelism.get_num_threads()); + } + + + /** + * @brief Choose multiway mergesort with exact splitting, + * for parallel sorting. + * @param begin Begin iterator of input sequence. + * @param end End iterator of input sequence. + * @param comp Comparator. + * @callgraph + */ + template<bool stable, typename RandomAccessIterator, typename Comparator> + inline void + parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, + Comparator comp, default_parallel_tag parallelism) + { + _GLIBCXX_CALL(end - begin) + + parallel_sort<stable> + (begin, end, comp, + multiway_mergesort_exact_tag(parallelism.get_num_threads())); + } + + + /** * @brief Choose a parallel sorting algorithm. * @param begin Begin iterator of input sequence. * @param end End iterator of input sequence. @@ -68,54 +197,38 @@ namespace __gnu_parallel * @param stable Sort stable. * @callgraph */ - template<typename RandomAccessIterator, typename Comparator> + template<bool stable, typename RandomAccessIterator, typename Comparator> inline void parallel_sort(RandomAccessIterator begin, RandomAccessIterator end, - Comparator comp, bool stable) + Comparator comp, parallel_tag parallelism) { _GLIBCXX_CALL(end - begin) typedef std::iterator_traits<RandomAccessIterator> traits_type; typedef typename traits_type::value_type value_type; typedef typename traits_type::difference_type difference_type; - if (begin != end) - { - difference_type n = end - begin; - - if (false) ; + if (false) ; #if _GLIBCXX_MERGESORT - else if (stable) - { - if(_Settings::get().sort_splitting == EXACT) - parallel_sort_mwms<true, true> - (begin, end, comp, get_max_threads()); - else - parallel_sort_mwms<true, false> - (begin, end, comp, get_max_threads()); - } - else if (_Settings::get().sort_algorithm == MWMS) - { - if(_Settings::get().sort_splitting == EXACT) - parallel_sort_mwms<false, true> - (begin, end, comp, get_max_threads()); - else - parallel_sort_mwms<false, false> - (begin, end, comp, get_max_threads()); - } + else if (stable || _Settings::get().sort_algorithm == MWMS) + { + if(_Settings::get().sort_splitting == EXACT) + parallel_sort_mwms<stable, true> + (begin, end, comp, parallelism.get_num_threads()); + else + parallel_sort_mwms<false, false> + (begin, end, comp, parallelism.get_num_threads()); + } #endif #if _GLIBCXX_QUICKSORT - else if (!stable && _Settings::get().sort_algorithm == QS) - parallel_sort_qs(begin, end, comp, n, get_max_threads()); + else if (_Settings::get().sort_algorithm == QS) + parallel_sort_qs(begin, end, comp, parallelism.get_num_threads()); #endif #if _GLIBCXX_BAL_QUICKSORT - else if (!stable && _Settings::get().sort_algorithm == QS_BALANCED) - parallel_sort_qsb(begin, end, comp, n, get_max_threads()); + else if (_Settings::get().sort_algorithm == QS_BALANCED) + parallel_sort_qsb(begin, end, comp, parallelism.get_num_threads()); #endif - else if(stable) - __gnu_sequential::stable_sort(begin, end, comp); - else - __gnu_sequential::sort(begin, end, comp); - } + else + __gnu_sequential::sort(begin, end, comp); } } // end namespace __gnu_parallel diff --git a/libstdc++-v3/include/parallel/tags.h b/libstdc++-v3/include/parallel/tags.h index f57add97c7b..cf937af4952 100644 --- a/libstdc++-v3/include/parallel/tags.h +++ b/libstdc++-v3/include/parallel/tags.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2007 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008 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 @@ -39,6 +39,9 @@ #ifndef _GLIBCXX_PARALLEL_TAGS_H #define _GLIBCXX_PARALLEL_TAGS_H 1 +#include <omp.h> +#include <parallel/types.h> + namespace __gnu_parallel { /** @brief Forces sequential execution at compile time. */ @@ -47,8 +50,53 @@ namespace __gnu_parallel /** @brief Forces exact splitting in multiway merge at compile time. */ struct exact_tag { }; - /** @brief Recommends parallel execution at compile time. */ - struct parallel_tag { }; + /** @brief Recommends parallel execution at compile time, + * optionally using a user-specified number of threads. */ + struct parallel_tag + { + private: + thread_index_t num_threads; + + public: + /** @brief Default constructor. Use default number of threads. */ + parallel_tag() + { + this->num_threads = 0; + } + + /** @brief Default constructor. Recommend number of threads to use. + * @param num_threads Desired number of threads. */ + parallel_tag(thread_index_t num_threads) + { + this->num_threads = num_threads; + } + + /** @brief Find out desired number of threads. + * @return Desired number of threads. */ + inline thread_index_t get_num_threads() + { + if(num_threads == 0) + return omp_get_max_threads(); + else + return num_threads; + } + + /** @brief Set the desired number of threads. + * @param num_threads Desired number of threads. */ + inline void set_num_threads(thread_index_t num_threads) + { + this->num_threads = num_threads; + } + }; + + /** @brief Recommends parallel execution using the + default parallel algorithm. */ + struct default_parallel_tag : public parallel_tag + { + default_parallel_tag() { } + default_parallel_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; /** @brief Recommends parallel execution using dynamic load-balancing at compile time. */ @@ -67,8 +115,56 @@ namespace __gnu_parallel struct omp_loop_static_tag : public parallel_tag { }; + /** @brief Base class for for std::find() variants. */ struct find_tag { }; + + /** @brief Forces parallel sorting using multiway mergesort + * at compile time. */ + struct multiway_mergesort_tag : public parallel_tag + { + multiway_mergesort_tag() { } + multiway_mergesort_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; + + /** @brief Forces parallel sorting using multiway mergesort + * with exact splitting at compile time. */ + struct multiway_mergesort_exact_tag : public parallel_tag + { + multiway_mergesort_exact_tag() { } + multiway_mergesort_exact_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; + + /** @brief Forces parallel sorting using multiway mergesort + * with splitting by sampling at compile time. */ + struct multiway_mergesort_sampling_tag : public parallel_tag + { + multiway_mergesort_sampling_tag() { } + multiway_mergesort_sampling_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; + + /** @brief Forces parallel sorting using unbalanced quicksort + * at compile time. */ + struct quicksort_tag : public parallel_tag + { + quicksort_tag() { } + quicksort_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; + + /** @brief Forces parallel sorting using balanced quicksort + * at compile time. */ + struct balanced_quicksort_tag : public parallel_tag + { + balanced_quicksort_tag() { } + balanced_quicksort_tag(thread_index_t num_threads) + : parallel_tag(num_threads) { } + }; + + /** @brief Selects the growing block size variant for std::find(). @see _GLIBCXX_FIND_GROWING_BLOCKS */ struct growing_blocks_tag : public find_tag { }; diff --git a/libstdc++-v3/libmath/Makefile.in b/libstdc++-v3/libmath/Makefile.in index d1f6dd606d5..1db093b15cc 100644 --- a/libstdc++-v3/libmath/Makefile.in +++ b/libstdc++-v3/libmath/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 35f55d7c3f2..76e34de03bf 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -51,6 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc index e4665773ca2..312166201fb 100644 --- a/libstdc++-v3/libsupc++/guard.cc +++ b/libstdc++-v3/libsupc++/guard.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc. +// Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -36,7 +36,7 @@ #include <ext/atomicity.h> #include <ext/concurrence.h> #if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \ - && defined(_GLIBCXX_ATOMIC_BUILTINS) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) + && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) # include <climits> # include <syscall.h> # define _GLIBCXX_USE_FUTEX diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in index 9ec489b0a32..c79788dac38 100644 --- a/libstdc++-v3/po/Makefile.in +++ b/libstdc++-v3/po/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index f7e10ac1663..492c8907ced 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -50,6 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ diff --git a/libstdc++-v3/src/atomic.cc b/libstdc++-v3/src/atomic.cc index e09a9d201b1..46d3f7698e9 100644 --- a/libstdc++-v3/src/atomic.cc +++ b/libstdc++-v3/src/atomic.cc @@ -54,7 +54,7 @@ namespace std atomic_flag_test_and_set_explicit(volatile atomic_flag* __a, memory_order __x) { -#ifdef _GLIBCXX_ATOMIC_BUILTINS +#ifdef _GLIBCXX_ATOMIC_BUILTINS_1 if (__x >= memory_order_acq_rel) __sync_synchronize(); return __sync_lock_test_and_set(&(__a->_M_base._M_b), 1); @@ -72,7 +72,7 @@ namespace std void atomic_flag_clear_explicit(volatile atomic_flag* __a, memory_order __x) { -#ifdef _GLIBCXX_ATOMIC_BUILTINS +#ifdef _GLIBCXX_ATOMIC_BUILTINS_1 __sync_lock_release(&(__a->_M_base._M_b)); if (__x >= memory_order_acq_rel) __sync_synchronize(); @@ -88,7 +88,7 @@ namespace std void atomic_flag_fence(const volatile atomic_flag*, memory_order) { -#ifdef _GLIBCXX_ATOMIC_BUILTINS +#ifdef _GLIBCXX_ATOMIC_BUILTINS_1 __sync_synchronize(); #endif } diff --git a/libstdc++-v3/testsuite/23_containers/list/operators/1.cc b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc index 1bc91914f44..1bc91914f44 100644 --- a/libstdc++-v3/testsuite/23_containers/list/operators/1.cc +++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/list/operators/2.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc index dc41e12c511..dc41e12c511 100644 --- a/libstdc++-v3/testsuite/23_containers/list/operators/2.cc +++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc diff --git a/libstdc++-v3/testsuite/23_containers/list/operators/3.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc index 9e0d3f9b561..9e0d3f9b561 100644 --- a/libstdc++-v3/testsuite/23_containers/list/operators/3.cc +++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc b/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc new file mode 100644 index 00000000000..97747ad9a6e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/operations/35969.cc @@ -0,0 +1,80 @@ +// Copyright (C) 2008 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. + +// 23.2.2.4 list operations [lib.list.ops] + +// { dg-options "-D_GLIBCXX_DEBUG" } + +#include <list> +#include <functional> + +// libstdc++/35969 +void test01() +{ + { + std::list<int> list1; + std::list<int> list2; + + for(int i = 0; i < 10; ++i) + { + list1.push_back(i); + list2.push_back(10 - i); + } + + list1.sort(); + list2.sort(); + + std::list<int>::iterator node_of_interest = list2.begin(); + + list1.splice(list1.begin(), list2, node_of_interest); + list2.splice(list2.begin(), list1, node_of_interest); + + list1.merge(list2); + + list2.splice(list2.begin(), list1, node_of_interest); + } + + { + std::list<int> list1; + std::list<int> list2; + + for(int i = 0; i < 10; ++i) + { + list1.push_back(i); + list2.push_back(10 - i); + } + + list1.sort(); + list2.sort(); + + std::list<int>::iterator node_of_interest = list2.begin(); + + list1.splice(list1.begin(), list2, node_of_interest); + list2.splice(list2.begin(), list1, node_of_interest); + + list1.merge(list2, std::less<int>()); + + list2.splice(list2.begin(), list1, node_of_interest); + } +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/operators/4.cc b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc index 2c355145cbe..2c355145cbe 100644 --- a/libstdc++-v3/testsuite/23_containers/list/operators/4.cc +++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc diff --git a/libstdc++-v3/testsuite/23_containers/list/operators/5.cc b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc index 22f504691d9..22f504691d9 100644 --- a/libstdc++-v3/testsuite/23_containers/list/operators/5.cc +++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 72b54f4f16f..c029ced7612 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lib-prefix.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/no-executables.m4 \ + $(top_srcdir)/../config/override.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/stdint.m4 \ $(top_srcdir)/../config/unwind_ipinfo.m4 \ |