This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Use __GCC_HAVE_SYNC_COMPARE_AND_SWAP_*
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 24 May 2007 19:48:42 +0200
- Subject: [Patch] Use __GCC_HAVE_SYNC_COMPARE_AND_SWAP_*
Hi,
the below finally uses a suitable built-in macros in concurrence.h.
Tested x86-linux and x86_64-linux.
Paolo.
////////////////////
2007-05-24 Paolo Carlini <pcarlini@suse.de>
* include/ext/concurrence.h: Use __GCC_HAVE_SYNC_COMPARE_AND_SWAP_*.
Index: include/ext/concurrence.h
===================================================================
--- include/ext/concurrence.h (revision 125028)
+++ include/ext/concurrence.h (working copy)
@@ -53,9 +53,8 @@
// the current configuration.
static const _Lock_policy __default_lock_policy =
#ifdef __GTHREADS
- // NB: This macro doesn't actually exist yet in the compiler, but is
- // set somewhat haphazardly at configure time.
-#ifdef _GLIBCXX_ATOMIC_BUILTINS
+#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \
+ && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4))
_S_atomic;
#else
_S_mutex;
@@ -63,7 +62,7 @@
#else
_S_single;
#endif
-
+
// NB: As this is used in libsupc++, need to only depend on
// exception. No stdexception classes, no use of std::string.
class __concurrence_lock_error : public std::exception