diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-01-30 16:07:00 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-01-30 16:07:00 +0000 |
commit | 47cb854818ed51d591f58552c6e681a2ad372bf8 (patch) | |
tree | ab46572dd15b0ed25ba7ba60bed03f0028e8c340 /libcxxabi/src/cxa_exception_storage.cpp | |
parent | 3f0d2384aa802af867541a6cf9ce29cc77be0019 (diff) | |
download | bcm5719-llvm-47cb854818ed51d591f58552c6e681a2ad372bf8.tar.gz bcm5719-llvm-47cb854818ed51d591f58552c6e681a2ad372bf8.zip |
Add a descriptive name for a constant. Also I'm at least temporarily waging war on throw specs, both old and new style. Except where we have already publicly exposed the throw spec, I'm getting rid of them. They may come back later. But they seem somewhat prone to cyclic dependencies here. The throw spec implies compiler generated code that this library has to jump to during stack unwinding. I'd like to minimize the possiblity that the code used to properly make that jump is itself creating such jumps.
llvm-svn: 149251
Diffstat (limited to 'libcxxabi/src/cxa_exception_storage.cpp')
-rw-r--r-- | libcxxabi/src/cxa_exception_storage.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp index 8688932b4e8..2c269c7fbd3 100644 --- a/libcxxabi/src/cxa_exception_storage.cpp +++ b/libcxxabi/src/cxa_exception_storage.cpp @@ -18,15 +18,15 @@ namespace __cxxabiv1 { namespace { - __cxa_eh_globals * __globals () noexcept { + __cxa_eh_globals * __globals () { static thread_local __cxa_eh_globals eh_globals; return &eh_globals; } } extern "C" { - __cxa_eh_globals * __cxa_get_globals () noexcept { return __globals (); } - __cxa_eh_globals * __cxa_get_globals_fast () noexcept { return __globals (); } + __cxa_eh_globals * __cxa_get_globals () { return __globals (); } + __cxa_eh_globals * __cxa_get_globals_fast () { return __globals (); } } } @@ -43,23 +43,22 @@ extern "C" { namespace __cxxabiv1 { namespace { pthread_key_t key_; + pthread_once_t flag_ = PTHREAD_ONCE_INIT; - void destruct_ (void *p) noexcept { + void destruct_ (void *p) { std::free ( p ); if ( 0 != ::pthread_setspecific ( key_, NULL ) ) abort_message("cannot zero out thread value for __cxa_get_globals()"); } - int construct_ () noexcept { + void construct_ () { if ( 0 != pthread_key_create ( &key_, destruct_ ) ) abort_message("cannot create pthread key for __cxa_get_globals()"); - return 0; } } extern "C" { - __cxa_eh_globals * __cxa_get_globals () noexcept { - + __cxa_eh_globals * __cxa_get_globals () { // Try to get the globals for this thread __cxa_eh_globals* retVal = __cxa_get_globals_fast (); @@ -79,9 +78,11 @@ extern "C" { // preceeded by a call to __cxa_get_globals(). This is an extension // to the Itanium ABI and is taken advantage of in several places in // libc++abi. - __cxa_eh_globals * __cxa_get_globals_fast () noexcept { + __cxa_eh_globals * __cxa_get_globals_fast () { // First time through, create the key. - static int init = construct_(); + if (0 != pthread_once(&flag_, construct_)) + abort_message("pthread_once failure in __cxa_get_globals_fast()"); +// static int init = construct_(); return static_cast<__cxa_eh_globals*>(::pthread_getspecific(key_)); } |