diff options
author | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2016-09-21 09:09:32 +0000 |
---|---|---|
committer | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2016-09-21 09:09:32 +0000 |
commit | b62a4dd90c2568cfc49f710d15a326b9ead3f610 (patch) | |
tree | ea7c73a31c1941d5789809a910ee2224b55d4aba /test/test_exception_storage.pass.cpp | |
parent | 933c4df930aaca33a7ced67edaaa4ab8e5c460cb (diff) |
[libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)
Align the naming / use of the macro LIBCXXABI_HAS_NO_THREADS to follow what we
have in libcxx. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@282062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/test_exception_storage.pass.cpp')
-rw-r--r-- | test/test_exception_storage.pass.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/test/test_exception_storage.pass.cpp b/test/test_exception_storage.pass.cpp index 0d5deaa..9081246 100644 --- a/test/test_exception_storage.pass.cpp +++ b/test/test_exception_storage.pass.cpp @@ -12,7 +12,7 @@ #include <cstdlib> #include <algorithm> #include <iostream> -#if !LIBCXXABI_HAS_NO_THREADS +#ifndef _LIBCXXABI_HAS_NO_THREADS # include <pthread.h> #endif #include <unistd.h> @@ -38,29 +38,16 @@ void *thread_code (void *parm) { return parm; } -#if !LIBCXXABI_HAS_NO_THREADS +#ifndef _LIBCXXABI_HAS_NO_THREADS #define NUMTHREADS 10 size_t thread_globals [ NUMTHREADS ] = { 0 }; pthread_t threads [ NUMTHREADS ]; #endif -void print_sizes ( size_t *first, size_t *last ) { - std::cout << "{ " << std::hex; - for ( size_t *iter = first; iter != last; ++iter ) - std::cout << *iter << " "; - std::cout << "}" << std::dec << std::endl; - } - int main ( int argc, char *argv [] ) { int retVal = 0; -#if LIBCXXABI_HAS_NO_THREADS - size_t thread_globals; - // Check that __cxa_get_globals() is not NULL. - if (thread_code(&thread_globals) == 0) { - retVal = 1; - } -#else +#ifndef _LIBCXXABI_HAS_NO_THREADS // Make the threads, let them run, and wait for them to finish for ( int i = 0; i < NUMTHREADS; ++i ) pthread_create( threads + i, NULL, thread_code, (void *) (thread_globals + i)); @@ -73,15 +60,18 @@ int main ( int argc, char *argv [] ) { retVal = 1; } -// print_sizes ( thread_globals, thread_globals + NUMTHREADS ); std::sort ( thread_globals, thread_globals + NUMTHREADS ); for ( int i = 1; i < NUMTHREADS; ++i ) if ( thread_globals [ i - 1 ] == thread_globals [ i ] ) { std::cerr << "Duplicate thread globals (" << i-1 << " and " << i << ")" << std::endl; retVal = 2; } -// print_sizes ( thread_globals, thread_globals + NUMTHREADS ); - -#endif - return retVal; +#else // _LIBCXXABI_HAS_NO_THREADS + size_t thread_globals; + // Check that __cxa_get_globals() is not NULL. + if (thread_code(&thread_globals) == 0) { + retVal = 1; } +#endif // !_LIBCXXABI_HAS_NO_THREADS + return retVal; +} |