diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2011-12-01 02:20:32 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2011-12-01 02:20:32 +0000 |
commit | a152e96f01344f3e3200c53a10d992420976b8d2 (patch) | |
tree | d4912787d66dc0363f377302abaa209272a433b0 /libstdc++-v3/libsupc++ | |
parent | de21ce7fa8f64a4438874ede019e77034de43310 (diff) | |
download | gcc-a152e96f01344f3e3200c53a10d992420976b8d2.zip gcc-a152e96f01344f3e3200c53a10d992420976b8d2.tar.gz gcc-a152e96f01344f3e3200c53a10d992420976b8d2.tar.bz2 |
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
Diffstat (limited to 'libstdc++-v3/libsupc++')
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.am | 20 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.in | 20 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/atomic_lockfree_defines.h | 63 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_ptr.cc | 5 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_throw.cc | 4 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/exception | 4 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/exception_ptr.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/guard.cc | 2 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/nested_exception.cc | 2 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/nested_exception.h | 2 |
10 files changed, 110 insertions, 14 deletions
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index c8e661d..fb5c26f 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -35,8 +35,8 @@ std_HEADERS = \ cxxabi.h exception initializer_list new typeinfo bits_HEADERS = \ - cxxabi_forced.h hash_bytes.h \ - exception_defines.h exception_ptr.h nested_exception.h + atomic_lockfree_defines.h cxxabi_forced.h \ + exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h headers = $(std_HEADERS) $(bits_HEADERS) @@ -136,6 +136,22 @@ cp-demangle.o: cp-demangle.c $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< +# Use special rules for the C++0x sources so that the proper flags are passed. +eh_ptr.lo: eh_ptr.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +eh_ptr.o: eh_ptr.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + +eh_throw.lo: eh_throw.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +eh_throw.o: eh_throw.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + +guard.lo: guard.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +guard.o: guard.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + nested_exception.lo: nested_exception.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< nested_exception.o: nested_exception.cc diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 191bd28..2cc92ec 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -346,8 +346,8 @@ std_HEADERS = \ cxxabi.h exception initializer_list new typeinfo bits_HEADERS = \ - cxxabi_forced.h hash_bytes.h \ - exception_defines.h exception_ptr.h nested_exception.h + atomic_lockfree_defines.h cxxabi_forced.h \ + exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h headers = $(std_HEADERS) $(bits_HEADERS) @GLIBCXX_HOSTED_TRUE@c_sources = \ @@ -770,6 +770,22 @@ cp-demangle.lo: cp-demangle.c cp-demangle.o: cp-demangle.c $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< +# Use special rules for the C++0x sources so that the proper flags are passed. +eh_ptr.lo: eh_ptr.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +eh_ptr.o: eh_ptr.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + +eh_throw.lo: eh_throw.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +eh_throw.o: eh_throw.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + +guard.lo: guard.cc + $(LTCXXCOMPILE) -std=gnu++0x -c $< +guard.o: guard.cc + $(CXXCOMPILE) -std=gnu++0x -c $< + nested_exception.lo: nested_exception.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< nested_exception.o: nested_exception.cc diff --git a/libstdc++-v3/libsupc++/atomic_lockfree_defines.h b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h new file mode 100644 index 0000000..22331b6 --- /dev/null +++ b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h @@ -0,0 +1,63 @@ +// -*- C++ -*- header. + +// Copyright (C) 2008, 2009, 2010, 2011 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 3, 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file bits/atomic_lockfree_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{atomic} + */ + +#ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H +#define _GLIBCXX_ATOMIC_LOCK_FREE_H 1 + +#pragma GCC system_header + +/** + * @addtogroup atomics + * @{ + */ + +/** + * Lock-free property. + * + * 0 indicates that the types are never lock-free. + * 1 indicates that the types are sometimes lock-free. + * 2 indicates that the types are always lock-free. + */ + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif + +// @} group atomics + +#endif diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc index 94c2842..0e710f2 100644 --- a/libstdc++-v3/libsupc++/eh_ptr.cc +++ b/libstdc++-v3/libsupc++/eh_ptr.cc @@ -1,5 +1,5 @@ // -*- C++ -*- Implement the members of exception_ptr. -// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -23,8 +23,9 @@ // <http://www.gnu.org/licenses/>. #include <bits/c++config.h> +#include <bits/atomic_lockfree_defines.h> -#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 +#if ATOMIC_INT_LOCK_FREE > 1 #define _GLIBCXX_EH_PTR_COMPAT diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc index 78cfc13..728c5cc 100644 --- a/libstdc++-v3/libsupc++/eh_throw.cc +++ b/libstdc++-v3/libsupc++/eh_throw.cc @@ -43,7 +43,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc) if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON) __terminate (header->exc.terminateHandler); -#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 +#if ATOMIC_INT_LOCK_FREE > 1 if (__sync_sub_and_fetch (&header->referenceCount, 1) == 0) { #endif @@ -51,7 +51,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc) header->exc.exceptionDestructor (header + 1); __cxa_free_exception (header + 1); -#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 +#if ATOMIC_INT_LOCK_FREE > 1 } #endif } diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index db75ad1..3deb45e 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -37,6 +37,7 @@ #pragma GCC visibility push(default) #include <bits/c++config.h> +#include <bits/atomic_lockfree_defines.h> extern "C++" { @@ -149,8 +150,7 @@ _GLIBCXX_END_NAMESPACE_VERSION #pragma GCC visibility pop -#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \ - && defined(_GLIBCXX_ATOMIC_BUILTINS_4)) +#if defined(__GXX_EXPERIMENTAL_CXX0X__) && (ATOMIC_INT_LOCK_FREE > 1) #include <bits/exception_ptr.h> #include <bits/nested_exception.h> #endif diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h index 00b30fd..bd18dc1 100644 --- a/libstdc++-v3/libsupc++/exception_ptr.h +++ b/libstdc++-v3/libsupc++/exception_ptr.h @@ -36,7 +36,7 @@ #include <bits/c++config.h> #include <bits/exception_defines.h> -#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4) +#if ATOMIC_INT_LOCK_FREE < 2 # error This platform does not support exception propagation. #endif diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc index 21bca58..643ecd7 100644 --- a/libstdc++-v3/libsupc++/guard.cc +++ b/libstdc++-v3/libsupc++/guard.cc @@ -32,7 +32,7 @@ #include <ext/atomicity.h> #include <ext/concurrence.h> #if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \ - && defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) + && (ATOMIC_INT_LOCK_FREE > 1) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) # include <climits> # include <syscall.h> # include <unistd.h> diff --git a/libstdc++-v3/libsupc++/nested_exception.cc b/libstdc++-v3/libsupc++/nested_exception.cc index ecbc4c8..ad83ecd 100644 --- a/libstdc++-v3/libsupc++/nested_exception.cc +++ b/libstdc++-v3/libsupc++/nested_exception.cc @@ -25,7 +25,7 @@ namespace std { -#ifdef _GLIBCXX_ATOMIC_BUILTINS_4 +#if ATOMIC_INT_LOCK_FREE > 1 nested_exception::~nested_exception() = default; #endif } // namespace std diff --git a/libstdc++-v3/libsupc++/nested_exception.h b/libstdc++-v3/libsupc++/nested_exception.h index d4804bb..9b99c32 100644 --- a/libstdc++-v3/libsupc++/nested_exception.h +++ b/libstdc++-v3/libsupc++/nested_exception.h @@ -38,7 +38,7 @@ #include <bits/c++config.h> -#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4) +#if ATOMIC_INT_LOCK_FREE < 2 # error This platform does not support exception propagation. #endif |