Commit Graph

37 Commits

Author SHA1 Message Date
Pauli Nieminen ed3cb49703 Support exception propagation without lock-free atomic int
2017-01-04  Pauli Nieminen  <suokkos@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/64735
	* acinclude.m4 (GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER): Define.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver [HAVE_EXCEPTION_PTR_SINCE_GCC46]
	(GLIBCXX_3.4.15, GLIBCXX_3.4.21, CXXABI_1.3.3, CXXABI_1.3.5): Make
	exports for exception_ptr, nested_exception, and future conditional.
	[HAVE_EXCEPTION_PTR_SINCE_GCC46] (GLIBCXX_3.4.23, CXXABI_1.3.11): Add
	exports for exception_ptr, nested_exception, and future conditional.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER.
	* include/std/future: Remove check for ATOMIC_INT_LOCK_FREE
	* libsupc++/eh_atomics.h: New file for internal use only.
	(__eh_atomic_inc, __eh_atomic_dec): New.
	* libsupc++/eh_ptr.cc (exception_ptr::_M_addref)
	(exception_ptr::_M_release) (__gxx_dependent_exception_cleanup)
	(rethrow_exception): Use eh_atomics.h reference counting helpers.
	* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Likewise.
	* libsupc++/eh_tm.cc (free_any_cxa_exception): Likewise.
	* libsupc++/exception: Remove check for ATOMIC_INT_LOCK_FREE.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/guard.cc: Include header for ATOMIC_INT_LOCK_FREE macro.
	* libsupc++/nested_exception.cc: Remove check for
	ATOMIC_INT_LOCK_FREE.
	* libsupc++/nested_exception.h: Likewise.
	* src/c++11/future.cc: Likewise.
	* testsuite/18_support/exception_ptr/*: Remove atomic builtins checks.
	* testsuite/18_support/nested_exception/*: Likewise.
	* testsuite/30_threads/async/*: Likewise.
	* testsuite/30_threads/future/*: Likewise.
	* testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/packaged_task/*: Likewise.
	* testsuite/30_threads/promise/*: Likewise.
	* testsuite/30_threads/shared_future/*: Likewise.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r244051
2017-01-04 10:54:59 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Uros Bizjak f2f48c6c60 * libsupc++/guard.cc: Revert my last commit.
From-SVN: r234336
2016-03-18 16:44:44 +01:00
Uros Bizjak 09d8f35943 Revert:
2015-07-02  Uros Bizjak  <ubizjak@gmail.com>

	* libsupc++/guard.cc (__test_and_acquire): Use __p after __atomic_load
	to avoid unused variable warning.
	(__set_and_release): Use __p after __atomic_store to avoid unused
	variable warning.

From-SVN: r234331
2016-03-18 16:28:54 +01:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Uros Bizjak 53ac92c3e0 guard.cc (__test_and_acquire): Use __p after __atomic_load to avoid unused variable warning.
* libsupc++/guard.cc (__test_and_acquire): Use __p after __atomic_load
	to avoid unused variable warning.
	(__set_and_release): Use __p after __atomic_store to avoid unused
	variable warning.

From-SVN: r225298
2015-07-02 07:58:12 +02:00
Ramana Radhakrishnan 57e6d9be77 Use atomics in guard.cc.
This provides proper definitions for _GLIBCXX_READ_MEM_BARRIER and
_GLIBCXX_WRITE_MEM_BARRIER, rewrites the guards in terms of proper
atomic extensions and removes internal uses of
_GLIBCXX_READ_MEM_BARRIER and _GLIBCXX_WRITE_MEM_BARRIER and replaces
them with equivalent atomics.

2015-06-12  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	PR target/66200
	PR c++/66192
	* * config/cpu/generic/atomic_word.h (_GLIBCXX_READ_MEM_BARRIER): Define
        (_GLIBCXX_WRITE_MEM_BARRIER): Likewise
        * include/bits/shared_ptr_base.h: Use ACQ_REL barrier.
        * include/ext/atomicity.h: Likewise.
        * include/tr1/shared_ptr.h: Likewise.
        * libsupc++/guard.cc (__test_and_acquire): Rewrite with atomics.
        Update comment.
        (__set_and_release): Likewise.
        * testsuite/20_util/shared_ptr/cons/43820_neg.cc (test01): Adjust for
	line numbers.
        * testsuite/20_util/shared_ptr/cons/void_neg.cc: Likewise.
        * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Likewise.

From-SVN: r224411
2015-06-12 09:49:41 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Jonathan Wakely 0f3d27f01a re PR libstdc++/64276 (would be better to use __cpp_exceptions rather than __EXCEPTIONS to determine whether exceptions are available)
PR libstdc++/64276
	* doc/doxygen/user.cfg.in: Define __cpp_exceptions and __cpp_rtti.
	* doc/html/manual/using_exceptions.html: Regenerate.
	* doc/xml/manual/using_exceptions.xml: Use SD-6 feature-testing
	macros, __cpp_exceptions and __cpp_rtti, instead of __EXCEPTIONS and
	__GXX_RTTI.
	* include/bits/c++config: Likewise.
	* include/bits/locale_classes.tcc: Likewise.
	* include/bits/shared_ptr.h: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/debug/formatter.h: Likewise.
	* include/experimental/any: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/std/functional: Likewise.
	* include/tr1/functional: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* libsupc++/eh_call.cc: Likewise.
	* libsupc++/eh_personality.cc: Likewise.
	* libsupc++/exception_defines.h: Likewise.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/guard.cc: Likewise.
	* libsupc++/pbase_type_info.cc: Likewise.
	* libsupc++/pointer_type_info.cc: Likewise.
	* libsupc++/vterminate.cc: Likewise.
	* src/c++11/thread.cc: Likewise.

From-SVN: r218679
2014-12-12 15:58:49 +00:00
Richard Sandiford aa118a03c4 Update copyright years in libstdc++-v3/
From-SVN: r206301
2014-01-02 22:30:10 +00:00
Richard Sandiford 405feeb871 Update copyright in libstdc++-v3.
From-SVN: r195701
2013-02-03 17:54:05 +00:00
Jakub Jelinek 635442bfd8 re PR libstdc++/54172 (__cxa_guard_acquire thread-safety issue)
PR libstdc++/54172
	* libsupc++/guard.cc (__cxa_guard_acquire): Fix up the last
	argument of the first __atomic_compare_exchange_n.

From-SVN: r191190
2012-09-11 17:22:54 +02:00
Thiago Macieira fa129f20b3 re PR libstdc++/54172 (__cxa_guard_acquire thread-safety issue)
2012-09-06  Thiago Macieira  <thiago.macieira@intel.com>

	PR libstdc++/54172
        * libsupc++/guard.cc (__cxa_guard_acquire): Exit the loop earlier if
        we detect that another thread has had success. Don't compare_exchange
        from a finished state back to a waiting state. Comment.

From-SVN: r191042
2012-09-06 20:31:08 +00:00
Richard Henderson b2cb69647e PR libstdc++/51798 continued
PR libstdc++/51798 continued
	* include/bits/shared_ptr_base.h
	(_Sp_counted_base<_S_atomic>::_M_add_ref_lock): Hoist initial load
	outside compare_exchange loop.
	* include/tr1/shared_ptr.h: Same.
	* include/parallel/compatibility.h (__compare_and_swap_32): Use strong
	version of compare_exchange.
	(__compare_and_swap_64): Same.
	* include/profile/impl/profiler_state.h (__gnu_profile::__turn): Same.
	* libsupc++/guard.cc (__cxa_guard_acquire): Same.

From-SVN: r184171
2012-02-13 13:30:31 -08:00
Benjamin Kosnik 75cee7c62a PR libstdc++/51798 continued.
2012-02-10  Benjamin Kosnik  <bkoz@redhat.com>
            Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/51798 continued.
	* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Use __atomic_*
	builtins instead of __sync_* builtins for atomic functionality.
	* include/bits/shared_ptr_base.h: Same.
	* include/parallel/compatibility.h: Same.
	* include/profile/impl/profiler_state.h: Same.
	* include/tr1/shared_ptr.h: Same.
	* libsupc++/eh_ptr.cc: Same.
	* libsupc++/eh_throw.cc: Same.
	* libsupc++/eh_tm.cc: Same.
	* libsupc++/guard.cc: Same.
	* configure: Regenerated.
	* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers.

Co-Authored-By: Jonathan Wakely <jwakely.gcc@gmail.com>

From-SVN: r184110
2012-02-10 18:20:43 +00:00
Benjamin Kosnik a152e96f01 acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove size-specific macros.
2011-11-30  Benjamin Kosnik  <bkoz@redhat.com>

        * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove
        size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1,
        _GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4,
        _GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to
        indicate use of C++11 atomic builtins.
        * config.h.in: Regenerate.
        * configure: Regenerate.
        * include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h.
        * include/Makefile.in: Regenerate.
        * libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x.
        * libsupc++/Makefile.in: Regenerate.

        * include/bits/atomic_base.h: Move lock-free property macros...
        * libsupc++/atomic_lockfree_defines.h: ...here.
        * include/std/future: Use C++11 macros.
        * libsupc++/eh_ptr.cc: Same.
        * libsupc++/eh_throw.cc: Same.
        * libsupc++/exception: Same.
        * libsupc++/exception_ptr.h: Same.
        * libsupc++/guard.cc: Same.
        * libsupc++/nested_exception.cc: Same.
        * libsupc++/nested_exception.h: Same.
        * src/future.cc: Same.

        * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS.

        * doc/doxygen/user.cfg.in
        * doc/xml/manual/concurrency_extensions.xml

        * testsuite/18_support/exception_ptr/lifespan.cc
        * testsuite/lib/libstdc++.exp

From-SVN: r181869
2011-12-01 02:20:32 +00:00
Paolo Carlini 6545e33e69 re PR libstdc++/49745 (error: ‘int truncate’ redeclared as different kind of symbol)
/gcc
2011-07-15  Paolo Carlini  <paolo.carlini@oracle.com>
	    Jakub Jelinek  <jakub@redhat.com>
	    Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/49745
	* gthr-posix.h: Do not include <unistd.h> unconditionally; use
	_GTHREADS_USE_MUTEX_TIMEDLOCK instead of _POSIX_TIMEOUTS.

/libstdc++-v3
2011-07-15  Paolo Carlini  <paolo.carlini@oracle.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/49745
	* acinclude.m4 ([GLIBCXX_CHECK_GTHREADS]): Check separately for
	_POSIX_TIMEOUTS and define _GTHREADS_USE_MUTEX_TIMEDLOCK.
	* libstdc++-v3/libsupc++/guard.cc: Include <unistd.h>.
	* testsuite/17_intro/headers/c++1998/49745.cc: New.
	* configure: Regenerate.
	* config.h.in: Likewise.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: Jonathan Wakely <jwakely.gcc@gmail.com>

From-SVN: r176335
2011-07-15 21:52:06 +00:00
Jonathan Wakely 50aeb6f48c guard.cc: Fix comments.
2011-05-26  Jonathan Wakely  <jwakely.gcc@gmail.com>

	* libsupc++/guard.cc: Fix comments.

From-SVN: r174241
2011-05-26 00:43:32 +01:00
Jonathan Wakely 2bddc50958 re PR libstdc++/43863 (Unused recursive_init_error class defined with -fno-exceptions)
2011-02-09  Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/43863
	* libsupc++/guard.cc (recursive_init_error::~recursive_init_error):
	Move to ...
	* libsupc++/guard_error.cc: ... new file.
	* libsupc++/Makefile.am: Update.
	* libsupc++/Makefile.in: Regenerate.

From-SVN: r169989
2011-02-09 23:22:27 +00:00
Benjamin Kosnik 8eead16e5e user.cfg.in: Regenerate, add files.
2009-11-09  Benjamin Kosnik  <bkoz@redhat.com>

	* doc/doxygen/user.cfg.in: Regenerate, add files.
	* libsupc++/eh_ptr.cc: Format.
	* libsupc++/exception_ptr.h: Same.
	* libsupc++/cxxabi.h(recursive_init_error): Move declaration here.
	* libsupc++/guard.cc: From here.
	* libsupc++/nested_exception.h: Add markup.

From-SVN: r154054
2009-11-09 22:09:30 +00:00
Jan Hubicka 5cf217fff1 * eh_type.cc (__cxa_current_exception_type) Mark throw().
* unwind-cxx.h (__cxa_get_globals, __cxa_get_globals_fast): Mark const.
	(__cxa_get_exception_ptr): Mark pure.
	(__cxa_bad_cast, __cxa_bad_typeid): Mark noreturn
	(__terminate): Makr throw ().
	* exception (terminate): Mark throw().
	(uncaught_exception): Mark pure.
	* eh_ptr.cc (_M_safe_bool_dummy): Mark throw().
	* guard.cc (__cxa_guard_abort, __cxa_guard_release): Mark throw().
	* eh_terminate.cc (__terminate, terminate): Mark throw().
	* vec.cc (__cxa_vec_cleanup): Mark throw().
	* cxxabi.h (__cxa_vec_cleanup, __cxa_guard_release, __cxa_guard_abort): Mark throw ().
	(__cxa_pure_virtual): Mark noreturn.
	(__cxa_current_exception_type): Mark throw and pure.
	* exception_ptr.h (operator ==, !=, _M_get, !, ==,
	__cxa_exception_type): Mark pure.
	(_M_safe_bool_dummy): Mark pure and const.

From-SVN: r146331
2009-04-18 22:18:21 +00:00
Jakub Jelinek 748086b7b2 Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
From-SVN: r145841
2009-04-09 17:00:19 +02:00
Benjamin Kosnik 35648b4572 acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Check for set of all used __sync builtins, in two sizes.
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.

From-SVN: r134629
2008-04-24 14:40:29 +00:00
Jakub Jelinek 0f3e711eef configure.ac (--enable-linux-futex): Add new configure option.
libstdc++-v3/
	* configure.ac (--enable-linux-futex): Add new configure option.
	(HAVE_LINUX_FUTEX): New AC_DEFINE.
	* Makefile.in: Rebuilt.
	* aclocal.m4: Rebuilt.
	* configure: Rebuilt.
	* config.h.in: Rebuilt.
	* config/cpu/generic/cxxabi_tweaks.h (_GLIBCXX_GUARD_BIT,
	_GLIBCXX_GUARD_PENDING_BIT, _GLIBCXX_GUARD_WAITING_BIT): Define.
	* config/cpu/arm/cxxabi_tweaks.h (_GLIBCXX_GUARD_BIT,
	_GLIBCXX_GUARD_PENDING_BIT, _GLIBCXX_GUARD_WAITING_BIT): Define.
	* libsupc++/guard.cc: Include climits and syscall.h.
	(_GLIBCXX_USE_FUTEX): Define if futex syscall and atomic builtins
	are supported.
	(_GLIBCXX_FUTEX_WAIT, _GLIBCXX_FUTEX_WAKE): Likewise.
	(__guard_test_bit): New static inline.
	(__cxa_guard_acquire, __cxa_guard_release, __cxa_guard_abort): Use
	atomic builtins and futex syscall if _GLIBCXX_USE_FUTEX.
config/
	* futex.m4: New file.
libgomp/
	* configure.ac: Move futex checking into ../config/futex.m4.
	* configure: Rebuilt.
	* aclocal.m4: Rebuilt.
	* Makefile.in: Rebuilt.

	* configure.tgt: Rename have_tls to gcc_cv_have_tls to match
	2007-10-15 ../config/tls.m4 change.

From-SVN: r131399
2008-01-08 17:14:49 +01:00
Jason Merrill b0bb87a862 guard.cc (struct mutex_wrapper): Move into anonymous namespace.
* libsupc++/guard.cc (struct mutex_wrapper): Move into
        anonymous namespace.

From-SVN: r129218
2007-10-10 19:06:08 -04:00
Zhou Drangon 3c8b6c602e re PR libstdc++/33682 (libstdc++ broken for !__GTHREAD_HAS_COND hosts)
2007-10-09  Zhou Drangon  <drangon.mail@gmail.com>

	PR libstdc++/33682
        * libsupc++/guard.cc: Make single conditional variable
        implementation dependent to __GTHREAD_HAS_COND.

From-SVN: r129181
2007-10-09 21:24:31 +00:00
Doug Kwan afd82ef5ab gthr-posix.h (__gthread_cond_broadcast, [...]): Add to extend interface for POSIX conditional variables.
2007-09-13  Doug Kwan  <dougkwan@google.com>

        * gcc/gthr-posix.h (__gthread_cond_broadcast, __gthread_cond_wait,
        __gthread_cond_wait_recursive): Add to extend interface for POSIX
        conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify
        support of conditional variables.
        * gcc/gthr-posix95.h (__gthread_cond_broadcast, __gthread_cond_wait,
        __gthread_cond_wait_recursive): Add to extend interface for POSIX
        conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify
        support of conditional variables.
        * gcc/gthr-single.h (__gthread_cond_broadcast, __gthread_cond_wait,
        __gthread_cond_wait_recursive): Add to extend interface for POSIX
        conditional variables.
        * gcc/gthr.h: Update comments to document new interface.
        * libstdc++-v3/include/ext/concurrent.h (class __mutex,
        class __recursive_mutex): Add new method gthread_mutex to access
        inner gthread mutex.
        [__GTHREAD_HAS_COND] (class __concurrence_broadcast_error,
        class __concurrence_wait_error, class __cond): Add.
        * guard.cc (recursive_push, recursive_pop): Delete.
        (init_in_progress_flag, set_init_in_progress_flag): Add to
        replace recursive_push and recursive_pop.
        (throw_recursive_init_exception): Add.
        (acquire, __cxa_guard_acquire, __cxa_guard_abort and
        __cxa_guard_release): [__GTHREAD_HAS_COND] Use a conditional
        for synchronization of static variable initialization.
        The global mutex is only held briefly when guards are
        accessed. [!__GTHREAD_HAS_COND] Fall back to the old code,
        which deadlocks.
        * testsuite/thread/guard.cc: Add new test. It deadlocks with the
        old locking code in libstdc++-v3/libsup++/guard.cc.

From-SVN: r129030
2007-10-05 01:35:46 -04:00
Benjamin Kosnik e64690af46 re PR libstdc++/29426 (static __recursive_mutex init vs __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION)
2006-10-11  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/29426
	* libsupc++/guard.cc (get_static_mutex): New. 
	(mutex_wrapper::mutex_wrapper): Use it to get properly initialized
	recursive mutex without ordering issues.

	* src/locale_init.cc (__get_locale_mutex): No need to
	uglify. Change to get_locale_mutex.

From-SVN: r117643
2006-10-11 20:18:36 +00:00
Benjamin Kosnik 2e362c7474 atomicity.h: Move to...
2006-09-13  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/atomicity.h: Move to...
	* include/ext/atomicity.h: ...here.	
	* include/bits/concurrence.h: Move to...
	* include/ext/concurrence.h: ...here.
	* include/Makefile.am (ext_headers): Additions.
	(bits_headers): Subtractions.
	* include/Makefile.in: Regenerate.

	* include/ext/bitmap_allocator.h (_Mutex), __threads_enabled,
	_Lock, _Auto_Lock): Subsume into...
	* include/bits/concurrence.h (__mutex): ..this. Error check
	locking and unlocking.	
	(lock): Uglify to...
	(__scoped_lock): Use __mutex. 
	(__glibcxx_mutex_define_initialized): Remove.
	(__glibcxx_mutex_type): Remove.

	* include/tr1/boost_shared_ptr.h: Formating tweaks, adjustments.
	(_Lock_policy): Move from here...
	* include/ext/concurrence.h: ... to here.
	(__shared_ptr_default_lock_mode): To __default_lock_policy.
	(_S_lockfree): To _S_atomic.
	Document.

	* libsupc++/guard.cc (static_mutex): Subsume into and fixup for...
	* include/ext/concurrence.h (__recursive_mutex): ...this. Error
	check locking and unlocking.
	* libsupc++/eh_alloc.cc: Use __scoped_lock.

	* config/os/aix/atomicity.h: Fixups for include paths, mutex to
	__scoped_mutex change, removal of locking defines.
	* config/os/irix/atomicity.h: Same.
	* config/cpu/cris/atomicity.h: Same.
	* config/cpu/m68k/atomicity.h: Same.
	* config/cpu/hppa/atomicity.h: Same.
	* config/cpu/mips/atomicity.h: Same.
	* config/cpu/sparc/atomicity.h: Same.
	* config/cpu/i386/atomicity.h: Same.
	* config/cpu/i486/atomicity.h: Same.
	* config/cpu/sh/atomicity.h: Same.
	* config/cpu/generic/atomicity_mutex/atomicity.h: Same.
	* include/ext/pool_allocator.h: Same.
	* include/ext/bitmap_allocator.h: Same.
	* include/ext/rc_string_base.h: Same.
	* include/ext/mt_allocator.h: Same.
	* include/bits/locale_classes.h: Same.
	* include/bits/basic_string.h: Same.
	* include/bits/ios_base.h: Same.
	* include/tr1/memory: Same.
	* src/pool_allocator.cc: Same.
	* src/mt_allocator.cc: Same.
	* src/locale_init.cc: Same.
	* src/ios.cc: Same.
	* src/locale.cc: Same.
	* src/bitmap_allocator.cc: Same.
	* src/ios_init.cc: Same.
	* src/debug.cc: Same.

From-SVN: r116942
2006-09-14 09:48:15 +00:00
Benjamin Kosnik b967bf2560 del_op.cc: Include c++config.h first.
2005-11-21  Benjamin Kosnik  <bkoz@redhat.com>

	* libsupc++/del_op.cc: Include c++config.h first.
	* libsupc++/eh_alloc.cc: Same.
	* libsupc++/new_opv.cc: Same.
	* libsupc++/eh_throw.cc: Same.
	* libsupc++/new_op.cc: Same.
	* libsupc++/del_opv.cc: Same.
	* libsupc++/eh_catch.cc: Same.
	* libsupc++/guard.cc: Same.
	* libsupc++/del_opnt.cc: Same.
	* libsupc++/eh_exception.cc: Same.
	* libsupc++/new_opvnt.cc: Same.
	* libsupc++/eh_term_handler.cc: Same.
	* libsupc++/eh_personality.cc: Same.
	* libsupc++/eh_call.cc: Same.
	* libsupc++/new_opnt.cc: Same.
	* libsupc++/del_opvnt.cc: Same.

2005-11-21  Benjamin Kosnik  <bkoz@redhat.com>

	* src/Makefile.am (LTCXXCOMPILE): CXXFLAGS last.
	* libsupc++/Makefile.am: Same.
	* src/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Same.

From-SVN: r107343
2005-11-22 00:19:07 +00:00
Kelley Cook 83f517994d All files: Update FSF address.
2005-08-17  Kelley Cook  <kcook@gcc.gnu.org>

	* All files: Update FSF address.

From-SVN: r103192
2005-08-17 02:28:44 +00:00
Jason Merrill 445cf5eb0d Add memory barriers to the double-checked locking used for static initialization.
libstdc++:
        Add memory barriers to the double-checked locking used for static
        initialization.
        * libsupc++/guard.cc (__test_and_acquire): Define default.
        (_GLIBCXX_GUARD_TEST_AND_ACQUIRE, __set_and_release)
        (_GLIBCXX_GUARD_SET_AND_RELEASE): Likewise.
        (recursion_push, recursion_pop): New abstraction functions.
        (__cxa_guard_acquire): Use _GLIBCXX_GUARD_TEST_AND_ACQUIRE.
        (__cxa_guard_release): Use _GLIBCXX_GUARD_SET_AND_RELEASE.
        * config/cpu/generic/cxxabi_tweaks.h (_GLIBCXX_GUARD_TEST): Rename
        from _GLIBCXX_GUARD_ACQUIRE and reverse sense.
        (_GLIBCXX_GUARD_SET): Rename from _GLIBCXX_GUARD_RELEASE.
        * config/cpu/arm/cxxabi_tweaks.h: Likewise.
        * config/cpu/alpha/atomic_word.h (_GLIBCXX_READ_MEM_BARRIER)
        (_GLIBCXX_WRITE_MEM_BARRIER): Define.
        * config/cpu/powerpc/atomic_word.h: Likewise.
        * config/cpu/sparc/atomic_word.h: Likewise.
        * config/cpu/generic/atomic_word.h: Define them, commented out.
        * include/bits/atomicity.h: Define defaults.
        * config/cpu/ia64/atomic_word.h (__test_and_acquire)
        (__set_and_release): New inlines.
        (_GLIBCXX_GUARD_TEST_AND_ACQUIRE): Define.
        (_GLIBCXX_GUARD_SET_AND_RELEASE): Define.

        * libsupc++/guard.cc (acquire_1): Use __builtin_trap instead of
        abort();

gcc:
        * doc/tm.texi (TARGET_RELAXED_ORDERING): Document.
        * target.h (struct gcc_target): Add relaxed_ordering field.
        * target-def.h (TARGET_RELAXED_ORDERING): Define default.
        (TARGET_INITIALIZER): Add it.
        * config/alpha/alpha.c (TARGET_RELAXED_ORDERING): Define.
        * config/ia64/ia64.c (TARGET_RELAXED_ORDERING): Define.
        * config/rs6000/rs6000.c (TARGET_RELAXED_ORDERING): Define.
        * config/sparc/sparc.c (TARGET_RELAXED_ORDERING): Define.
        * cp/decl.c (expand_static_init): Don't use shortcut if
        targetm.relaxed_ordering.

From-SVN: r92659
2004-12-27 23:36:54 -05:00
Jason Merrill 40aac94801 re PR c++/13684 (local static object variable constructed once but ctors and dtors called multiple times on same memory when called in multiple threads)
PR c++/13684
        * cp/decl.c (expand_static_init): Use thread-safety API.
        (register_dtor_fn): Return the call, don't expand it.
        * cp/tree.c (add_stmt_to_compound): New fn.
        (stabilize_call): Use it.
        * gimplify.c (gimplify_cleanup_point_expr): Handle CLEANUP_EH_ONLY.
        (gimple_push_cleanup): Add eh_only parm.
        (gimplify_target_expr): Pass it.
        * c.opt (-fno-threadsafe-statics): New option.
        * c-opts.c (c_common_handle_option): Handle it.
        * c-common.h (flag_threadsafe_statics): Declare it.
        * c-common.c (flag_threadsafe_statics): Record it.
        * doc/invoke.texi: Document it.
        * tsystem.h (_GNU_SOURCE): Define.
        * gthr-posix.h (__gthread_recursive_mutex_t): New typedef.
        (__GTHREAD_RECURSIVE_MUTEX_INIT): New macro.
        (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION): New macro.
        (__gthread_recursive_mutex_init_function): New fn.
        (__gthread_recursive_mutex_lock): New fn.
        (__gthread_recursive_mutex_trylock): New fn.
        (__gthread_recursive_mutex_unlock): New fn.
        * gthr-solaris.h, gthr-single.h, gthr-dce.h: Likewise.
        * gthr-win32.h, gthr-vxworks.h: Likewise.
        * gthr.h: Document.

        * libsupc++/guard.cc (static_mutex): Internal class implementing a
        recursive mutex which controls initialization of local statics.
        (__gnu_cxx::recursive_init): New exception class.
        (__cxa_guard_acquire): Deal with locking and recursion detection.
        (acquire_1, __cxa_guard_abort, __cxa_guard_release): Likewise.

From-SVN: r86687
2004-08-27 22:33:54 -04:00
Jason Merrill 27f577e57d fix typo
From-SVN: r85715
2004-08-09 09:18:56 -04:00
Paul Brook 1568430fae configure.ac: Set ABI_TWEAKS_SRCDIR.
* configure.ac: Set ABI_TWEAKS_SRCDIR.
	* configure.host: Set abi_tweaks_dir.  Check for atomicity.h when
	setting atomicity_dir.  Override type_cpu for arm based targets.
	* include/Makefile.am (host_headers): Add cxxabi_tweaks.h.
	* libsupc++/cxxabi.h: Include bits/cxxabi.h. Don't declare __guard.
	* libsupc++/guard.cc: Use definitions from cxxabi_tweaks.h.
	* libsupc++/vec.cc: Ditto.
	* config/cpu/arm/cxxabi_tweaks.h: New file.
	* config/cpu/generic/cxxabi_tweaks.h: New file.
	* */Makefile.in: Regenerate.
	* configure: Regenerate.

From-SVN: r84032
2004-07-02 23:40:19 +00:00
Paul Brook 4185ae5397 target-def.h (TARGET_CXX_GUARD_TYPE, [...]): Define.
gcc/
	* target-def.h (TARGET_CXX_GUARD_TYPE, TARGET_CXX_GUARD_MASK_BIT,
	TARGET_CXX): Define.
	(TARGET_INITIALIZER): Use TARGET_CXX.
	* target.h (struct gcc_target): Add struct cxx.
	* targhooks.h (default_cxx_guard_type): Add prototype.
	* targhooks.c (default_cxx_guard_type): New function.
	* config/arm/arm.c (TARGET_CXX_GUARD_TYPE, TARGET_CXX_GUARD_MASK_BIT):
	Define.
	(arm_cxx_guard_type, arm_cxx_guard_mask_bit): New functions.
	* doc/tm.texi: Document TARGET_CXX_GUARD_TYPE and
	TARGET_CXX_GUARD_MASK_BIT.
gcc/cp/
	* decl2.c (get_guard): Call targetm.cxx.guard_type.
	(get_guard_bits, get_guard_cond): Call targetm.cxx.guard_mask_bit.
libstdc++/
	* libsupc++/cxxabi.h: Define __ARM_EABI__
	(__guard): Use it.
	* libsupc++/guard.h (__cxa_guard_acquire, __cxa_guard_release): Ditto.

From-SVN: r83660
2004-06-25 17:15:46 +00:00
Mark Mitchell c4f6640537 Makefile.am (sources): Add guard.cc.
* libsupc++/Makefile.am (sources): Add guard.cc.
	* libsupc++/Makefile.in: Regenerated.
	* libsupc++/cxxabi.h (__cxa_guard_acquire): New function.
	(__cxa_guard_release): Likewise.
	(__cxa_guard_abort): Likewise.
	* libsupc++/guard.cc: New file.

From-SVN: r59475
2002-11-25 23:17:31 +00:00