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 | 7c98baab29f8ade4b0f69d482f9ce0bef4063b65 (patch) | |
| tree | 498736f8a414d36691c775120f438072ef372c15 /libcxxabi/test/test_exception_storage.pass.cpp | |
| parent | 099771b736a142dbd168311f29f38c6e71c8bbad (diff) | |
| download | bcm5719-llvm-7c98baab29f8ade4b0f69d482f9ce0bef4063b65.tar.gz bcm5719-llvm-7c98baab29f8ade4b0f69d482f9ce0bef4063b65.zip | |
[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.
llvm-svn: 282062
Diffstat (limited to 'libcxxabi/test/test_exception_storage.pass.cpp')
| -rw-r--r-- | libcxxabi/test/test_exception_storage.pass.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/libcxxabi/test/test_exception_storage.pass.cpp b/libcxxabi/test/test_exception_storage.pass.cpp index 0d5deaa3735..90812469281 100644 --- a/libcxxabi/test/test_exception_storage.pass.cpp +++ b/libcxxabi/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; +} |

