Skip to content

Commit 3695367

Browse files
committed
Apply clang-format
1 parent b769758 commit 3695367

File tree

1 file changed

+96
-104
lines changed

1 file changed

+96
-104
lines changed

libcxx/test/std/atomics/types.pass.cpp

Lines changed: 96 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -30,162 +30,154 @@
3030
#endif
3131

3232
template <class A, bool Integral>
33-
struct test_atomic
34-
{
35-
test_atomic()
36-
{
37-
A a; (void)a;
33+
struct test_atomic {
34+
test_atomic() {
35+
A a;
36+
(void)a;
3837
#if TEST_STD_VER >= 17
3938
static_assert((std::is_same_v<typename A::value_type, decltype(a.load())>), "");
4039
#endif
41-
}
40+
}
4241
};
4342

4443
template <class A>
45-
struct test_atomic<A, true>
46-
{
47-
test_atomic()
48-
{
49-
A a; (void)a;
44+
struct test_atomic<A, true> {
45+
test_atomic() {
46+
A a;
47+
(void)a;
5048
#if TEST_STD_VER >= 17
5149
static_assert((std::is_same_v<typename A::value_type, decltype(a.load())>), "");
5250
static_assert((std::is_same_v<typename A::value_type, typename A::difference_type>), "");
5351
#endif
54-
}
52+
}
5553
};
5654

5755
template <class A>
58-
struct test_atomic<A*, false>
59-
{
60-
test_atomic()
61-
{
62-
A a; (void)a;
56+
struct test_atomic<A*, false> {
57+
test_atomic() {
58+
A a;
59+
(void)a;
6360
#if TEST_STD_VER >= 17
6461
static_assert((std::is_same_v<typename A::value_type, decltype(a.load())>), "");
6562
static_assert((std::is_same_v<typename A::difference_type, std::ptrdiff_t>), "");
6663
#endif
67-
}
64+
}
6865
};
6966

7067
template <class T>
71-
void
72-
test()
73-
{
74-
using A = std::atomic<T>;
68+
void test() {
69+
using A = std::atomic<T>;
7570
#if TEST_STD_VER >= 17
76-
static_assert((std::is_same_v<typename A::value_type, T>), "");
71+
static_assert((std::is_same_v<typename A::value_type, T>), "");
7772
#endif
78-
test_atomic<A, std::is_integral<T>::value && !std::is_same<T, bool>::value>();
73+
test_atomic<A, std::is_integral<T>::value && !std::is_same<T, bool>::value>();
7974
}
8075

8176
struct TriviallyCopyable {
82-
int i_;
77+
int i_;
8378
};
8479

85-
struct WeirdTriviallyCopyable
86-
{
87-
char i, j, k; /* the 3 chars of doom */
80+
struct WeirdTriviallyCopyable {
81+
char i, j, k; /* the 3 chars of doom */
8882
};
8983

90-
struct PaddedTriviallyCopyable
91-
{
92-
char i; int j; /* probably lock-free? */
84+
struct PaddedTriviallyCopyable {
85+
char i;
86+
int j; /* probably lock-free? */
9387
};
9488

95-
struct LargeTriviallyCopyable
96-
{
97-
int i, j[127]; /* decidedly not lock-free */
89+
struct LargeTriviallyCopyable {
90+
int i, j[127]; /* decidedly not lock-free */
9891
};
9992

100-
int main(int, char**)
101-
{
102-
test<bool> ();
103-
test<char> ();
104-
test<signed char> ();
105-
test<unsigned char> ();
106-
test<short> ();
107-
test<unsigned short> ();
108-
test<int> ();
109-
test<unsigned int> ();
110-
test<long> ();
111-
test<unsigned long> ();
112-
test<long long> ();
113-
test<unsigned long long> ();
93+
int main(int, char**) {
94+
test<bool>();
95+
test<char>();
96+
test<signed char>();
97+
test<unsigned char>();
98+
test<short>();
99+
test<unsigned short>();
100+
test<int>();
101+
test<unsigned int>();
102+
test<long>();
103+
test<unsigned long>();
104+
test<long long>();
105+
test<unsigned long long>();
114106
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
115-
test<char8_t> ();
107+
test<char8_t>();
116108
#endif
117-
test<char16_t> ();
118-
test<char32_t> ();
109+
test<char16_t>();
110+
test<char32_t>();
119111
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
120-
test<wchar_t> ();
112+
test<wchar_t>();
121113
#endif
122114

123-
test<std::int_least8_t> ();
124-
test<std::uint_least8_t> ();
125-
test<std::int_least16_t> ();
126-
test<std::uint_least16_t> ();
127-
test<std::int_least32_t> ();
128-
test<std::uint_least32_t> ();
129-
test<std::int_least64_t> ();
130-
test<std::uint_least64_t> ();
131-
132-
test<std::int_fast8_t> ();
133-
test<std::uint_fast8_t> ();
134-
test<std::int_fast16_t> ();
135-
test<std::uint_fast16_t> ();
136-
test<std::int_fast32_t> ();
137-
test<std::uint_fast32_t> ();
138-
test<std::int_fast64_t> ();
139-
test<std::uint_fast64_t> ();
140-
141-
test< std::int8_t> ();
142-
test<std::uint8_t> ();
143-
test< std::int16_t> ();
144-
test<std::uint16_t> ();
145-
test< std::int32_t> ();
146-
test<std::uint32_t> ();
147-
test< std::int64_t> ();
148-
test<std::uint64_t> ();
149-
150-
test<std::intptr_t> ();
151-
test<std::uintptr_t> ();
152-
test<std::size_t> ();
153-
test<std::ptrdiff_t> ();
154-
test<std::intmax_t> ();
155-
test<std::uintmax_t> ();
156-
157-
test<std::uintmax_t> ();
158-
test<std::uintmax_t> ();
159-
160-
test<TriviallyCopyable>();
161-
test<PaddedTriviallyCopyable>();
115+
test<std::int_least8_t>();
116+
test<std::uint_least8_t>();
117+
test<std::int_least16_t>();
118+
test<std::uint_least16_t>();
119+
test<std::int_least32_t>();
120+
test<std::uint_least32_t>();
121+
test<std::int_least64_t>();
122+
test<std::uint_least64_t>();
123+
124+
test<std::int_fast8_t>();
125+
test<std::uint_fast8_t>();
126+
test<std::int_fast16_t>();
127+
test<std::uint_fast16_t>();
128+
test<std::int_fast32_t>();
129+
test<std::uint_fast32_t>();
130+
test<std::int_fast64_t>();
131+
test<std::uint_fast64_t>();
132+
133+
test< std::int8_t>();
134+
test<std::uint8_t>();
135+
test< std::int16_t>();
136+
test<std::uint16_t>();
137+
test< std::int32_t>();
138+
test<std::uint32_t>();
139+
test< std::int64_t>();
140+
test<std::uint64_t>();
141+
142+
test<std::intptr_t>();
143+
test<std::uintptr_t>();
144+
test<std::size_t>();
145+
test<std::ptrdiff_t>();
146+
test<std::intmax_t>();
147+
test<std::uintmax_t>();
148+
149+
test<std::uintmax_t>();
150+
test<std::uintmax_t>();
151+
152+
test<TriviallyCopyable>();
153+
test<PaddedTriviallyCopyable>();
162154
#ifndef __APPLE__ // Apple doesn't ship libatomic
163-
/*
155+
/*
164156
These aren't going to be lock-free,
165157
so some libatomic.a is necessary.
166158
*/
167-
test<WeirdTriviallyCopyable>();
168-
test<LargeTriviallyCopyable>();
159+
test<WeirdTriviallyCopyable>();
160+
test<LargeTriviallyCopyable>();
169161
#endif
170162

171163
#ifndef TEST_HAS_NO_THREADS
172-
test<std::thread::id>();
164+
test<std::thread::id>();
173165
#endif
174-
test<std::chrono::nanoseconds>();
175-
test<float>();
166+
test<std::chrono::nanoseconds>();
167+
test<float>();
176168

177169
#if TEST_STD_VER >= 20
178-
test<std::atomic_signed_lock_free::value_type>();
179-
static_assert(std::is_signed_v<std::atomic_signed_lock_free::value_type>);
180-
static_assert(std::is_integral_v<std::atomic_signed_lock_free::value_type>);
170+
test<std::atomic_signed_lock_free::value_type>();
171+
static_assert(std::is_signed_v<std::atomic_signed_lock_free::value_type>);
172+
static_assert(std::is_integral_v<std::atomic_signed_lock_free::value_type>);
181173

182-
test<std::atomic_unsigned_lock_free::value_type>();
183-
static_assert(std::is_unsigned_v<std::atomic_unsigned_lock_free::value_type>);
184-
static_assert(std::is_integral_v<std::atomic_unsigned_lock_free::value_type>);
174+
test<std::atomic_unsigned_lock_free::value_type>();
175+
static_assert(std::is_unsigned_v<std::atomic_unsigned_lock_free::value_type>);
176+
static_assert(std::is_integral_v<std::atomic_unsigned_lock_free::value_type>);
185177
/*
186178
test<std::shared_ptr<int>>();
187179
*/
188180
#endif
189181

190-
return 0;
182+
return 0;
191183
}

0 commit comments

Comments
 (0)