Skip to content

Commit 77054f3

Browse files
committed
[libc++abi][NFC] Run clang-format on a test that I am about to modify
https://reviews.llvm.org/D138460 touches that test a bunch, so we might as well clang-format it first.
1 parent ecbd523 commit 77054f3

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

libcxxabi/test/test_exception_storage.pass.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,61 @@
1616

1717
#include "test_macros.h"
1818

19-
typedef __cxxabiv1::__cxa_eh_globals globals_t ;
19+
typedef __cxxabiv1::__cxa_eh_globals globals_t;
2020

21-
void *thread_code (void *parm) {
22-
size_t *result = (size_t *) parm;
23-
globals_t *glob1, *glob2;
21+
void* thread_code(void* parm) {
22+
size_t* result = (size_t*)parm;
23+
globals_t *glob1, *glob2;
2424

25-
glob1 = __cxxabiv1::__cxa_get_globals ();
26-
if ( NULL == glob1 )
27-
std::printf("Got null result from __cxa_get_globals\n");
25+
glob1 = __cxxabiv1::__cxa_get_globals();
26+
if (NULL == glob1)
27+
std::printf("Got null result from __cxa_get_globals\n");
2828

29-
glob2 = __cxxabiv1::__cxa_get_globals_fast ();
30-
if ( glob1 != glob2 )
31-
std::printf("Got different globals!\n");
29+
glob2 = __cxxabiv1::__cxa_get_globals_fast();
30+
if (glob1 != glob2)
31+
std::printf("Got different globals!\n");
3232

33-
*result = (size_t) glob1;
33+
*result = (size_t)glob1;
3434
#ifndef TEST_HAS_NO_THREADS
35-
sleep ( 1 );
35+
sleep(1);
3636
#endif
37-
return parm;
37+
return parm;
3838
}
3939

4040
#ifndef TEST_HAS_NO_THREADS
41-
#define NUMTHREADS 10
42-
size_t thread_globals [ NUMTHREADS ] = { 0 };
43-
std::__libcpp_thread_t threads [ NUMTHREADS ];
41+
# define NUMTHREADS 10
42+
size_t thread_globals[NUMTHREADS] = {0};
43+
std::__libcpp_thread_t threads[NUMTHREADS];
4444
#endif
4545

4646
int main() {
4747
#ifndef TEST_HAS_NO_THREADS
48-
// Make the threads, let them run, and wait for them to finish
49-
for ( int i = 0; i < NUMTHREADS; ++i )
50-
std::__libcpp_thread_create ( threads + i, thread_code, (void *) (thread_globals + i));
51-
for ( int i = 0; i < NUMTHREADS; ++i )
52-
std::__libcpp_thread_join ( &threads [ i ] );
48+
// Make the threads, let them run, and wait for them to finish
49+
for (int i = 0; i < NUMTHREADS; ++i)
50+
std::__libcpp_thread_create(threads + i, thread_code, (void*)(thread_globals + i));
51+
for (int i = 0; i < NUMTHREADS; ++i)
52+
std::__libcpp_thread_join(&threads[i]);
5353

54-
int retVal = 0;
55-
for ( int i = 0; i < NUMTHREADS; ++i ) {
56-
if ( 0 == thread_globals [ i ] ) {
57-
std::printf("Thread #%d had a zero global\n", i);
58-
retVal = 1;
59-
}
54+
int retVal = 0;
55+
for (int i = 0; i < NUMTHREADS; ++i) {
56+
if (0 == thread_globals[i]) {
57+
std::printf("Thread #%d had a zero global\n", i);
58+
retVal = 1;
6059
}
60+
}
6161

62-
std::sort ( thread_globals, thread_globals + NUMTHREADS );
63-
for ( int i = 1; i < NUMTHREADS; ++i ) {
64-
if ( thread_globals [ i - 1 ] == thread_globals [ i ] ) {
65-
std::printf("Duplicate thread globals (%d and %d)\n", i-1, i);
66-
retVal = 2;
67-
}
62+
std::sort(thread_globals, thread_globals + NUMTHREADS);
63+
for (int i = 1; i < NUMTHREADS; ++i) {
64+
if (thread_globals[i - 1] == thread_globals[i]) {
65+
std::printf("Duplicate thread globals (%d and %d)\n", i - 1, i);
66+
retVal = 2;
6867
}
69-
return retVal;
70-
#else // TEST_HAS_NO_THREADS
71-
size_t thread_globals;
72-
thread_code(&thread_globals);
73-
// Check that __cxa_get_globals() is not NULL.
74-
return (thread_globals == 0) ? 1 : 0;
68+
}
69+
return retVal;
70+
#else // TEST_HAS_NO_THREADS
71+
size_t thread_globals;
72+
thread_code(&thread_globals);
73+
// Check that __cxa_get_globals() is not NULL.
74+
return (thread_globals == 0) ? 1 : 0;
7575
#endif // !TEST_HAS_NO_THREADS
7676
}

0 commit comments

Comments
 (0)