Hi danalbert,

Also remove the audotedection part so that if you're crazy enough to want a 
single threaded abi library, you'll say so explicitly in the build.

http://reviews.llvm.org/D5216

Files:
  src/config.h
  src/cxa_exception.cpp
  src/cxa_exception_storage.cpp
  src/cxa_guard.cpp
  src/fallback_malloc.ipp
  test/test_exception_storage.cpp
Index: src/config.h
===================================================================
--- src/config.h
+++ src/config.h
@@ -16,11 +16,9 @@
 
 #include <unistd.h>
 
-#if !defined(LIBCXXABI_SINGLE_THREADED) && \
-    defined(_POSIX_THREADS) && _POSIX_THREADS > 0
-#  define LIBCXXABI_SINGLE_THREADED 0
-#else
-#  define LIBCXXABI_SINGLE_THREADED 1
+// Set this in the CXXFLAGS when you need it
+#if !defined(LIBCXXABI_HAS_NO_THREADS)
+#  define LIBCXXABI_HAS_NO_THREADS 0
 #endif
 
 // Set this in the CXXFLAGS when you need it, because otherwise we'd have to
Index: src/cxa_exception.cpp
===================================================================
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -17,7 +17,7 @@
 #include <exception>        // for std::terminate
 #include <cstdlib>          // for malloc, free
 #include <cstring>          // for memset
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
 #  include <pthread.h>      // for fallback_malloc.ipp's mutexes
 #endif
 #include "cxa_exception.hpp"
Index: src/cxa_exception_storage.cpp
===================================================================
--- src/cxa_exception_storage.cpp
+++ src/cxa_exception_storage.cpp
@@ -15,7 +15,7 @@
 
 #include "config.h"
 
-#if LIBCXXABI_SINGLE_THREADED
+#if LIBCXXABI_HAS_NO_THREADS
 
 namespace __cxxabiv1 {
 extern "C" {
Index: src/cxa_guard.cpp
===================================================================
--- src/cxa_guard.cpp
+++ src/cxa_guard.cpp
@@ -10,7 +10,7 @@
 #include "abort_message.h"
 #include "config.h"
 
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
 #  include <pthread.h>
 #endif
 #include <stdint.h>
@@ -62,7 +62,7 @@
 
 #endif
 
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
 pthread_mutex_t guard_mut = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t  guard_cv  = PTHREAD_COND_INITIALIZER;
 #endif
@@ -166,7 +166,7 @@
 extern "C"
 {
 
-#if LIBCXXABI_SINGLE_THREADED
+#if LIBCXXABI_HAS_NO_THREADS
 int __cxa_guard_acquire(guard_type* guard_object)
 {
     return !is_initialized(guard_object);
@@ -183,7 +183,7 @@
     *guard_object = 0;
 }
 
-#else // !LIBCXXABI_SINGLE_THREADED
+#else // !LIBCXXABI_HAS_NO_THREADS
 
 int __cxa_guard_acquire(guard_type* guard_object)
 {
@@ -250,7 +250,7 @@
         abort_message("__cxa_guard_abort failed to broadcast condition variable");
 }
 
-#endif // !LIBCXXABI_SINGLE_THREADED
+#endif // !LIBCXXABI_HAS_NO_THREADS
 
 }  // extern "C"
 
Index: src/fallback_malloc.ipp
===================================================================
--- src/fallback_malloc.ipp
+++ src/fallback_malloc.ipp
@@ -26,7 +26,7 @@
 namespace {
 
 // When POSIX threads are not available, make the mutex operations a nop
-#if LIBCXXABI_SINGLE_THREADED
+#if LIBCXXABI_HAS_NO_THREADS
 static void * heap_mutex = 0;
 #else
 static pthread_mutex_t heap_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -34,7 +34,7 @@
 
 class mutexor {
 public:
-#if LIBCXXABI_SINGLE_THREADED
+#if LIBCXXABI_HAS_NO_THREADS
     mutexor ( void * ) {}
     ~mutexor () {}
 #else
@@ -44,7 +44,7 @@
 private:
     mutexor ( const mutexor &rhs );
     mutexor & operator = ( const mutexor &rhs );
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
     pthread_mutex_t *mtx_;
 #endif
     };
Index: test/test_exception_storage.cpp
===================================================================
--- test/test_exception_storage.cpp
+++ test/test_exception_storage.cpp
@@ -12,7 +12,7 @@
 #include <cstdlib>
 #include <algorithm>
 #include <iostream>
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
 #  include <pthread.h>
 #endif
 #include <unistd.h>
@@ -38,7 +38,7 @@
     return parm;
     }
 
-#if !LIBCXXABI_SINGLE_THREADED
+#if !LIBCXXABI_HAS_NO_THREADS
 #define NUMTHREADS  10
 size_t      thread_globals [ NUMTHREADS ] = { 0 };
 pthread_t   threads        [ NUMTHREADS ];
@@ -54,7 +54,7 @@
 int main ( int argc, char *argv [] ) {
     int retVal = 0;
 
-#if LIBCXXABI_SINGLE_THREADED
+#if LIBCXXABI_HAS_NO_THREADS
     size_t thread_globals;
     retVal = thread_code(&thread_globals) != 0;
 #else
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to