[libcxx-commits] [libcxxabi] 6e91666 - [libcxxabi] NFC: fix incorrect indentation of braces
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Sep 11 11:43:34 PDT 2021
Author: Zhouyi Zhou
Date: 2021-09-11T13:43:12-05:00
New Revision: 6e91666e2864eae2190ba9d2c59c7ff80ed7b836
URL: https://github.com/llvm/llvm-project/commit/6e91666e2864eae2190ba9d2c59c7ff80ed7b836
DIFF: https://github.com/llvm/llvm-project/commit/6e91666e2864eae2190ba9d2c59c7ff80ed7b836.diff
LOG: [libcxxabi] NFC: fix incorrect indentation of braces
Some functions in cxa_exception_storage.cpp have incorrect indentation
of braces; fix them.
Original patch by Zhouyi Zhou <zhouzhouyi at gmail.com>
Also, remove a line of commented-out (and no-longer-possible-to-compile)
code. That thread-safe-static initialization of `init` was replaced
with the call to pthread_once directly above it, back in 2012.
Differential Revision: https://reviews.llvm.org/D109408
Added:
Modified:
libcxxabi/src/cxa_exception_storage.cpp
Removed:
################################################################################
diff --git a/libcxxabi/src/cxa_exception_storage.cpp b/libcxxabi/src/cxa_exception_storage.cpp
index 24ff55e39d291..2832466cf6926 100644
--- a/libcxxabi/src/cxa_exception_storage.cpp
+++ b/libcxxabi/src/cxa_exception_storage.cpp
@@ -21,25 +21,24 @@ extern "C" {
static __cxa_eh_globals eh_globals;
__cxa_eh_globals *__cxa_get_globals() { return &eh_globals; }
__cxa_eh_globals *__cxa_get_globals_fast() { return &eh_globals; }
- }
-}
+} // extern "C"
+} // namespace __cxxabiv1
#elif defined(HAS_THREAD_LOCAL)
namespace __cxxabiv1 {
-
namespace {
- __cxa_eh_globals * __globals () {
+ __cxa_eh_globals *__globals() {
static thread_local __cxa_eh_globals eh_globals;
return &eh_globals;
- }
}
+} // namespace
extern "C" {
- __cxa_eh_globals * __cxa_get_globals () { return __globals (); }
- __cxa_eh_globals * __cxa_get_globals_fast () { return __globals (); }
- }
-}
+ __cxa_eh_globals *__cxa_get_globals() { return __globals(); }
+ __cxa_eh_globals *__cxa_get_globals_fast() { return __globals(); }
+} // extern "C"
+} // namespace __cxxabiv1
#else
@@ -59,47 +58,46 @@ namespace {
std::__libcpp_tls_key key_;
std::__libcpp_exec_once_flag flag_ = _LIBCPP_EXEC_ONCE_INITIALIZER;
- void _LIBCPP_TLS_DESTRUCTOR_CC destruct_ (void *p) {
- __free_with_fallback ( p );
- if ( 0 != std::__libcpp_tls_set ( key_, NULL ) )
+ void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) {
+ __free_with_fallback(p);
+ if (0 != std::__libcpp_tls_set(key_, NULL))
abort_message("cannot zero out thread value for __cxa_get_globals()");
- }
+ }
- void construct_ () {
- if ( 0 != std::__libcpp_tls_create ( &key_, destruct_ ) )
+ void construct_() {
+ if (0 != std::__libcpp_tls_create(&key_, destruct_))
abort_message("cannot create thread specific key for __cxa_get_globals()");
- }
-}
+ }
+} // namespace
extern "C" {
- __cxa_eh_globals * __cxa_get_globals () {
- // Try to get the globals for this thread
- __cxa_eh_globals* retVal = __cxa_get_globals_fast ();
-
- // If this is the first time we've been asked for these globals, create them
- if ( NULL == retVal ) {
- retVal = static_cast<__cxa_eh_globals*>
- (__calloc_with_fallback (1, sizeof (__cxa_eh_globals)));
- if ( NULL == retVal )
+ __cxa_eh_globals *__cxa_get_globals() {
+ // Try to get the globals for this thread
+ __cxa_eh_globals *retVal = __cxa_get_globals_fast();
+
+ // If this is the first time we've been asked for these globals, create them
+ if (NULL == retVal) {
+ retVal = static_cast<__cxa_eh_globals*>(
+ __calloc_with_fallback(1, sizeof(__cxa_eh_globals)));
+ if (NULL == retVal)
abort_message("cannot allocate __cxa_eh_globals");
- if ( 0 != std::__libcpp_tls_set ( key_, retVal ) )
+ if (0 != std::__libcpp_tls_set(key_, retVal))
abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()");
- }
- return retVal;
}
+ return retVal;
+ }
// Note that this implementation will reliably return NULL if not
// preceded 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 () {
- // First time through, create the key.
+ __cxa_eh_globals *__cxa_get_globals_fast() {
+ // First time through, create the key.
if (0 != std::__libcpp_execute_once(&flag_, construct_))
abort_message("execute once failure in __cxa_get_globals_fast()");
-// static int init = construct_();
return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_));
- }
+ }
+} // extern "C"
+} // namespace __cxxabiv1
-}
-}
#endif
More information about the libcxx-commits
mailing list