This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] updated atomic configury


Here's the first step in making the libstdc++ atomic configure bits into
something that makes more sense. This consolidates the builtin parts of
the configury, such that builtins mean C++11 atomics, not C++11 atomics
mixed with pre-C++11 atomics.

I think this is mostly right, modulo my logic on the equivalency of
ATOMIC_INT_LOCK_FREE == _GLIBCXX_ATOMIC_BUILTINS_4. This is something
that should hold, IMHO.

I was expecting
the C++11 macros for lock-free properties, ie ATOMIC_BOOL_LOCK_FREE to
be either 0, 1, 2, and to be able to use them like:

#if (ATOMIC_INT_LOCK_FREE > 1)
// yes, cool, yeah!
#endif

But this doesn't seem to work. And what I have in this patch, which is

#if defined(ATOMIC_INT_LOCK_FREE)

doesn't really say the same thing...

-benjamin

tested x86/linux
tested x86/linux x cris-elf
tested x86/linux x arm-eabi-elf
2011-11-21  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


diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index fee5c6f..9d08178 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2683,12 +2683,6 @@ dnl
 dnl Note:
 dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
 dnl
-dnl Defines:
-dnl  _GLIBCXX_ATOMIC_BUILTINS_1
-dnl  _GLIBCXX_ATOMIC_BUILTINS_2
-dnl  _GLIBCXX_ATOMIC_BUILTINS_4
-dnl  _GLIBCXX_ATOMIC_BUILTINS_8
-dnl
 AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
@@ -2729,10 +2723,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
       [glibcxx_cv_atomic_bool=yes],
       [glibcxx_cv_atomic_bool=no])
   ])
-  if test $glibcxx_cv_atomic_bool = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
-      [Define if builtin atomic operations for bool are supported on this host.])
-  fi
   AC_MSG_RESULT($glibcxx_cv_atomic_bool)
 
   AC_MSG_CHECKING([for atomic builtins for short])
@@ -2751,10 +2741,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
       [glibcxx_cv_atomic_short=yes],
       [glibcxx_cv_atomic_short=no])
   ])
-  if test $glibcxx_cv_atomic_short = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
-      [Define if builtin atomic operations for short are supported on this host.])
-  fi
   AC_MSG_RESULT($glibcxx_cv_atomic_short)
 
   AC_MSG_CHECKING([for atomic builtins for int])
@@ -2773,10 +2759,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
       [glibcxx_cv_atomic_int=yes],
       [glibcxx_cv_atomic_int=no])
   ])
-  if test $glibcxx_cv_atomic_int = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
-      [Define if builtin atomic operations for int are supported on this host.])
-  fi
   AC_MSG_RESULT($glibcxx_cv_atomic_int)
 
   AC_MSG_CHECKING([for atomic builtins for long long])
@@ -2795,10 +2777,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
       [glibcxx_cv_atomic_long_long=yes],
       [glibcxx_cv_atomic_long_long=no])
   ])
-  if test $glibcxx_cv_atomic_long_long = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
-      [Define if builtin atomic operations for long long are supported on this host.])
-  fi
   AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
 
   else
@@ -2832,8 +2810,6 @@ EOF
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_bool=no
       else
-      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
-      [Define if builtin atomic operations for bool are supported on this host.])
 	glibcxx_cv_atomic_bool=yes
       fi
     fi
@@ -2862,8 +2838,6 @@ EOF
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_short=no
       else
-      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
-      [Define if builtin atomic operations for short are supported on this host.])
 	glibcxx_cv_atomic_short=yes
       fi
     fi
@@ -2893,8 +2867,6 @@ EOF
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_int=no
       else
-      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
-	[Define if builtin atomic operations for int are supported on this host.])
 	glibcxx_cv_atomic_int=yes
       fi
     fi
@@ -2923,8 +2895,6 @@ EOF
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_long_long=no
       else
-      AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
-      [Define if builtin atomic operations for long long are supported on this host.])
 	glibcxx_cv_atomic_long_long=yes
       fi
     fi
@@ -2938,6 +2908,8 @@ EOF
 
   # Set atomicity_dir to builtins if either of above tests pass.
   if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
+    [Define if the compiler supports C++11 atomics.])
     atomicity_dir=cpu/generic/atomicity_builtins
   fi
 
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 7215a7f..378ddab 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -689,19 +689,8 @@
 /* Version number of package */
 #undef VERSION
 
-/* Define if builtin atomic operations for bool are supported on this host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_1
-
-/* Define if builtin atomic operations for short are supported on this host.
-   */
-#undef _GLIBCXX_ATOMIC_BUILTINS_2
-
-/* Define if builtin atomic operations for int are supported on this host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_4
-
-/* Define if builtin atomic operations for long long are supported on this
-   host. */
-#undef _GLIBCXX_ATOMIC_BUILTINS_8
+/* Define if the compiler supports C++11 atomics. */
+#undef _GLIBCXX_ATOMIC_BUILTINS
 
 /* Define to use concept checking code from the boost libraries. */
 #undef _GLIBCXX_CONCEPT_CHECKS
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fa755b4..223d95f 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15147,11 +15147,6 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-  if test $glibcxx_cv_atomic_bool = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
-
-  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_bool" >&5
 $as_echo "$glibcxx_cv_atomic_bool" >&6; }
 
@@ -15193,11 +15188,6 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-  if test $glibcxx_cv_atomic_short = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
-
-  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_short" >&5
 $as_echo "$glibcxx_cv_atomic_short" >&6; }
 
@@ -15239,11 +15229,6 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-  if test $glibcxx_cv_atomic_int = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
-
-  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_int" >&5
 $as_echo "$glibcxx_cv_atomic_int" >&6; }
 
@@ -15285,11 +15270,6 @@ rm -f core conftest.err conftest.$ac_objext \
 
 fi
 
-  if test $glibcxx_cv_atomic_long_long = yes; then
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
-
-  fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_long_long" >&5
 $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
 
@@ -15303,7 +15283,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
   # Fake what AC_TRY_COMPILE does.
 
     cat > conftest.$ac_ext << EOF
-#line 15306 "configure"
+#line 15286 "configure"
 int main()
 {
   typedef bool atomic_type;
@@ -15329,9 +15309,6 @@ $as_echo_n "checking for atomic builtins for bool... " >&6; }
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_bool=no
       else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
-
 	glibcxx_cv_atomic_bool=yes
       fi
     fi
@@ -15340,7 +15317,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15343 "configure"
+#line 15320 "configure"
 int main()
 {
   typedef short atomic_type;
@@ -15366,9 +15343,6 @@ $as_echo_n "checking for atomic builtins for short... " >&6; }
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_short=no
       else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
-
 	glibcxx_cv_atomic_short=yes
       fi
     fi
@@ -15377,7 +15351,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15380 "configure"
+#line 15354 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -15404,9 +15378,6 @@ $as_echo_n "checking for atomic builtins for int... " >&6; }
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_int=no
       else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
-
 	glibcxx_cv_atomic_int=yes
       fi
     fi
@@ -15415,7 +15386,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15418 "configure"
+#line 15389 "configure"
 int main()
 {
   typedef long long atomic_type;
@@ -15441,9 +15412,6 @@ $as_echo_n "checking for atomic builtins for long long... " >&6; }
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
 	glibcxx_cv_atomic_long_long=no
       else
-
-$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
-
 	glibcxx_cv_atomic_long_long=yes
       fi
     fi
@@ -15463,6 +15431,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
   # Set atomicity_dir to builtins if either of above tests pass.
   if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+
+$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS 1" >>confdefs.h
+
     atomicity_dir=cpu/generic/atomicity_builtins
   fi
 
@@ -15491,7 +15462,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15494 "configure"
+#line 15465 "configure"
 int main()
 {
   _Decimal32 d1;
@@ -15533,7 +15504,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 15536 "configure"
+#line 15507 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
@@ -15567,7 +15538,7 @@ $as_echo "$enable_int128" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 15570 "configure"
+#line 15541 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in
index 0b01ceb..9178b0c 100644
--- a/libstdc++-v3/doc/doxygen/user.cfg.in
+++ b/libstdc++-v3/doc/doxygen/user.cfg.in
@@ -1645,10 +1645,6 @@ PREDEFINED             = __cplusplus \
 			 _GLIBCXX_USE_WCHAR_T \
 			 _GLIBCXX_USE_LONG_LONG \
 			 _GLIBCXX_USE_C99_STDINT_TR1 \
-			 _GLIBCXX_ATOMIC_BUILTINS_1 \
-			 _GLIBCXX_ATOMIC_BUILTINS_2 \
-			 _GLIBCXX_ATOMIC_BUILTINS_4 \
-			 _GLIBCXX_ATOMIC_BUILTINS_8 \
 			 _GLIBCXX_USE_SCHED_YIELD \
 			 _GLIBCXX_USE_NANOSLEEP \
 			 PB_DS_DATA_TRUE_INDICATOR \
diff --git a/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml b/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
index 9092c8d..c87f41b 100644
--- a/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
+++ b/libstdc++-v3/doc/xml/manual/concurrency_extensions.xml
@@ -210,11 +210,19 @@ usage vary depending on the target hardware and the flags used during
 compile.
 </para>
 
+
+
+<para>
+<remark>
+Incomplete/inconsistent. This is only C++11.
+</remark>
+</para>
+
 <para>
 If builtins are possible for bool-sized integral types,
-<code>_GLIBCXX_ATOMIC_BUILTINS_1</code> will be defined.
+<code>ATOMIC_BOOL_LOCK_FREE</code> will be defined.
 If builtins are possible for int-sized integral types,
-<code>_GLIBCXX_ATOMIC_BUILTINS_4</code> will be defined.
+<code>ATOMIC_INT_LOCK_FREE</code> will be defined.
 </para>
 
 
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 121a642..1e9b144 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -177,6 +177,7 @@ bits_headers = \
 
 bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
 bits_sup_headers = \
+	${bits_sup_srcdir}/atomic_lockfree_defines.h \
 	${bits_sup_srcdir}/cxxabi_forced.h \
 	${bits_sup_srcdir}/exception_defines.h \
 	${bits_sup_srcdir}/exception_ptr.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 70c0781..fec2d94 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -429,6 +429,7 @@ bits_headers = \
 
 bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
 bits_sup_headers = \
+	${bits_sup_srcdir}/atomic_lockfree_defines.h \
 	${bits_sup_srcdir}/cxxabi_forced.h \
 	${bits_sup_srcdir}/exception_defines.h \
 	${bits_sup_srcdir}/exception_ptr.h \
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index cf292a8..3f00cda 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -35,6 +35,7 @@
 #include <bits/c++config.h>
 #include <stdbool.h>
 #include <stdint.h>
+#include <bits/atomic_lockfree_defines.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -70,15 +71,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   inline void
   atomic_thread_fence(memory_order __m) noexcept
-  {
-    __atomic_thread_fence (__m);
-  }
+  { __atomic_thread_fence(__m); }
 
   inline void
   atomic_signal_fence(memory_order __m) noexcept
-  {
-    __atomic_thread_fence (__m);
-  }
+  { __atomic_thread_fence(__m); }
 
   /// kill_dependency
   template<typename _Tp>
@@ -89,20 +86,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __ret;
     }
 
-  /// Lock-free Property
-
-#define LOCKFREE_PROP(T) (__atomic_always_lock_free (sizeof (T), 0) ? 2 : 1)
-
-#define ATOMIC_BOOL_LOCK_FREE		LOCKFREE_PROP (bool)
-#define ATOMIC_CHAR_LOCK_FREE 		LOCKFREE_PROP (char)
-#define ATOMIC_CHAR16_T_LOCK_FREE	LOCKFREE_PROP (char16_t)
-#define ATOMIC_CHAR32_T_LOCK_FREE	LOCKFREE_PROP (char32_t)
-#define ATOMIC_WCHAR_T_LOCK_FREE	LOCKFREE_PROP (wchar_t)
-#define ATOMIC_SHORT_LOCK_FREE		LOCKFREE_PROP (short)
-#define ATOMIC_INT_LOCK_FREE		LOCKFREE_PROP (int)
-#define ATOMIC_LONG_LOCK_FREE		LOCKFREE_PROP (long)
-#define ATOMIC_LLONG_LOCK_FREE		LOCKFREE_PROP (long long)
-#define ATOMIC_POINTER_LOCK_FREE	LOCKFREE_PROP (void *)
 
   // Base types for atomics.
   template<typename _IntTp>
diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h
index f0c7752..c63b1d4 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, 2008, 2009, 2010
+// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // To abstract locking primitives across all thread policies, use:
   // __exchange_and_add_dispatch
   // __atomic_add_dispatch
-#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
+#ifdef _GLIBCXX_ATOMIC_BUILTINS
   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/std/future b/libstdc++-v3/include/std/future
index bfd1ff9..e9c5d17 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -187,7 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     async(_Fn&& __fn, _Args&&... __args);
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
-  && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+  && defined(ATOMIC_INT_LOCK_FREE)
 
   /// Base class and enclosing scope.
   struct __future_base
@@ -1493,7 +1493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
-       // && _GLIBCXX_ATOMIC_BUILTINS_4
+       // && ATOMIC_INT_LOCK_FREE
 
   // @} group futures
 _GLIBCXX_END_NAMESPACE_VERSION
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..f879b1b
--- /dev/null
+++ b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
@@ -0,0 +1,66 @@
+// -*- 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.
+ */
+
+#define __LOCK_FREE_PROPERTY(T) (__atomic_always_lock_free(sizeof(T), 0) \
+				 ? 2 : __atomic_is_lock_free(sizeof(T)))
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#define ATOMIC_BOOL_LOCK_FREE 		__LOCK_FREE_PROPERTY(bool)
+#define ATOMIC_CHAR_LOCK_FREE 		__LOCK_FREE_PROPERTY(char)
+#define ATOMIC_CHAR16_T_LOCK_FREE	__LOCK_FREE_PROPERTY(char16_t)
+#define ATOMIC_CHAR32_T_LOCK_FREE	__LOCK_FREE_PROPERTY(char32_t)
+#define ATOMIC_WCHAR_T_LOCK_FREE	__LOCK_FREE_PROPERTY(wchar_t)
+#define ATOMIC_SHORT_LOCK_FREE		__LOCK_FREE_PROPERTY(short)
+#define ATOMIC_INT_LOCK_FREE		__LOCK_FREE_PROPERTY(int)
+#define ATOMIC_LONG_LOCK_FREE		__LOCK_FREE_PROPERTY(long)
+#define ATOMIC_LLONG_LOCK_FREE		__LOCK_FREE_PROPERTY(long long)
+#define ATOMIC_POINTER_LOCK_FREE	__LOCK_FREE_PROPERTY(void*)
+#endif
+
+// @} group atomics
+
+#endif
diff --git a/libstdc++-v3/libsupc++/eh_ptr.cc b/libstdc++-v3/libsupc++/eh_ptr.cc
index 94c2842..cc916d7 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
+#ifdef ATOMIC_INT_LOCK_FREE
 
 #define _GLIBCXX_EH_PTR_COMPAT
 
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index 78cfc13..48f4c2d 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
+#ifdef ATOMIC_INT_LOCK_FREE
   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
+#ifdef ATOMIC_INT_LOCK_FREE
     }
 #endif
 }
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index db75ad1..e7eaa45 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__) && defined(ATOMIC_INT_LOCK_FREE)
 #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..07bc15a 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)
+#ifndef ATOMIC_INT_LOCK_FREE
 #  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..b9c7283 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)
+  && defined(ATOMIC_INT_LOCK_FREE) && 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..2f7ee6a 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
+#ifdef ATOMIC_INT_LOCK_FREE
   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..a61247b 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)
+#ifndef ATOMIC_INT_LOCK_FREE
 #  error This platform does not support exception propagation.
 #endif
 
diff --git a/libstdc++-v3/src/future.cc b/libstdc++-v3/src/future.cc
index 8569bf0..bb22718 100644
--- a/libstdc++-v3/src/future.cc
+++ b/libstdc++-v3/src/future.cc
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   future_error::what() const noexcept { return _M_code.message().c_str(); }
 
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
-  && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+  && defined(ATOMIC_INT_LOCK_FREE)
   __future_base::_Result_base::_Result_base() = default;
 
   __future_base::_Result_base::~_Result_base() = default;
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
index 704f77e..b417ea6 100644
--- a/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/lifespan.cc
@@ -150,11 +150,14 @@ void test06()
 
   may_destruct = false;
 
-  try {
-    test06_helper();
-  } catch(...) {
-    may_destruct = true;
-  }
+  try 
+    {
+      test06_helper();
+    } 
+  catch(...) 
+    {
+      may_destruct = true;
+    }
   may_destruct = false;
 }
 
@@ -167,11 +170,14 @@ void test99()
 
   may_destruct = false;
 
-  try {
-    throw destructing();
-  } catch(...) {
-    gep = current_exception();
-  }
+  try 
+    {
+      throw destructing();
+    } 
+  catch(...) 
+    {
+      gep = current_exception();
+    }
 }
 
 int main()
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index e419192..6e9b20b 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1219,14 +1219,14 @@ proc check_v3_target_atomic_builtins { } {
 	set src atomic_builtins[pid].cc
 
 	set f [open $src "w"]
-	puts $f "#include <bits/c++config.h>"
-	puts $f "#ifndef _GLIBCXX_ATOMIC_BUILTINS_4"
-	puts $f "#  error No atomic builtins"
+	puts $f "#include <bits/atomic_lockfree_defines.h>"
+	puts $f "#ifndef ATOMIC_INT_LOCK_FREE"
+	puts $f "#  error No atomic int"
 	puts $f "#endif"
 	close $f
 
 	set cxxflags_saved $cxxflags
-	set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+	set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++0x"
 
 	set lines [v3_target_compile $src /dev/null preprocess ""]
 	set cxxflags $cxxflags_saved

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]