[libcxx-commits] [libcxx] [libc++] Remove macros for keeping std::allocator members and void specialization after C++20 (PR #85806)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 19 08:46:28 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 9a3ece232ced907f87ed0d5846a57f6d9cbc9832 473aeaebb3a60c4d91c698f6b6cf24d46789fa87 -- libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.verify.cpp libcxx/include/__config libcxx/include/__memory/allocator.h libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.verify.cpp libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.verify.cpp libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.verify.cpp libcxx/test/std/containers/sequences/deque/types.pass.cpp libcxx/test/std/containers/sequences/list/types.pass.cpp libcxx/test/std/containers/sequences/vector/types.pass.cpp libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.verify.cpp libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.verify.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.verify.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.verify.cpp
index b2ceba8faf..21fd4d2344 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.verify.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.verify.cpp
@@ -21,25 +21,22 @@
#include "test_macros.h"
template <class T>
-void test_address()
-{
- T* tp = new T();
- const T* ctp = tp;
- const std::allocator<T> a;
- assert(a.address(*tp) == tp); // expected-error 2 {{no member}}
- assert(a.address(*ctp) == tp); // expected-error 2 {{no member}}
- delete tp;
+void test_address() {
+ T* tp = new T();
+ const T* ctp = tp;
+ const std::allocator<T> a;
+ assert(a.address(*tp) == tp); // expected-error 2 {{no member}}
+ assert(a.address(*ctp) == tp); // expected-error 2 {{no member}}
+ delete tp;
}
-struct A
-{
- void operator&() const {}
+struct A {
+ void operator&() const {}
};
-int main(int, char**)
-{
- test_address<int>();
- test_address<A>();
+int main(int, char**) {
+ test_address<int>();
+ test_address<A>();
return 0;
}
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.verify.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.verify.cpp
index f4ff536d47..b39f9d918c 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.verify.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.verify.cpp
@@ -20,61 +20,58 @@
int A_constructed = 0;
-struct A
-{
- int data;
- A() {++A_constructed;}
+struct A {
+ int data;
+ A() { ++A_constructed; }
- A(const A&) {++A_constructed;}
+ A(const A&) { ++A_constructed; }
- explicit A(int) {++A_constructed;}
- A(int, int*) {++A_constructed;}
+ explicit A(int) { ++A_constructed; }
+ A(int, int*) { ++A_constructed; }
- ~A() {--A_constructed;}
+ ~A() { --A_constructed; }
};
int move_only_constructed = 0;
-class move_only
-{
- move_only(const move_only&) = delete;
- move_only& operator=(const move_only&)= delete;
+class move_only {
+ move_only(const move_only&) = delete;
+ move_only& operator=(const move_only&) = delete;
public:
- move_only(move_only&&) {++move_only_constructed;}
- move_only& operator=(move_only&&) {return *this;}
+ move_only(move_only&&) { ++move_only_constructed; }
+ move_only& operator=(move_only&&) { return *this; }
- move_only() {++move_only_constructed;}
- ~move_only() {--move_only_constructed;}
+ move_only() { ++move_only_constructed; }
+ ~move_only() { --move_only_constructed; }
public:
- int data; // unused other than to make sizeof(move_only) == sizeof(int).
- // but public to suppress "-Wunused-private-field"
+ int data; // unused other than to make sizeof(move_only) == sizeof(int).
+ // but public to suppress "-Wunused-private-field"
};
-int main(int, char**)
-{
+int main(int, char**) {
{
std::allocator<A> a;
A* ap = a.allocate(3);
- a.construct(ap); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
- a.construct(ap, A()); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
- a.construct(ap, 5); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
+ a.construct(ap); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
+ a.construct(ap, A()); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
+ a.construct(ap, 5); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
a.construct(ap, 5, (int*)0); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
a.deallocate(ap, 3);
}
- {
+ {
std::allocator<move_only> a;
move_only* ap = a.allocate(3);
- a.construct(ap); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
+ a.construct(ap); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
a.construct(ap, move_only()); // expected-error {{no member}}
- a.destroy(ap); // expected-error {{no member}}
+ a.destroy(ap); // expected-error {{no member}}
a.deallocate(ap, 3);
- }
+ }
return 0;
}
diff --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.verify.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.verify.cpp
index 9455ed65ae..0e0f3c3f4a 100644
--- a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.verify.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.verify.cpp
@@ -23,11 +23,10 @@
int new_called = 0;
-int main(int, char**)
-{
- const std::allocator<int> a;
- std::size_t M = a.max_size(); // expected-error {{no member}}
- assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
+int main(int, char**) {
+ const std::allocator<int> a;
+ std::size_t M = a.max_size(); // expected-error {{no member}}
+ assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
index ceb0241801..8c14de0c77 100644
--- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
@@ -44,14 +44,22 @@ test()
typedef std::deque<T, Allocator> C;
static_assert((std::is_same<typename C::value_type, T>::value), "");
- static_assert((std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
- static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
- static_assert((std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value), "");
- static_assert((std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
- static_assert((std::is_same<typename C::const_reference, const typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert(
+ (std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value),
+ "");
+ static_assert(
+ (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert((std::is_same<typename C::const_reference,
+ const typename std::allocator_traits<Allocator>::value_type&>::value),
+ "");
static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
- static_assert((std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
static_assert((std::is_same<
typename std::iterator_traits<typename C::iterator>::iterator_category,
std::random_access_iterator_tag>::value), "");
diff --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.pass.cpp
index 323f0a3057..ad7641da20 100644
--- a/libcxx/test/std/containers/sequences/list/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/types.pass.cpp
@@ -36,9 +36,11 @@ int main(int, char**)
static_assert((std::is_same<C::value_type, int>::value), "");
static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
static_assert((std::is_same<C::reference, std::allocator_traits<std::allocator<int>>::value_type&>::value), "");
- static_assert((std::is_same<C::const_reference, const std::allocator_traits<std::allocator<int>>::value_type&>::value), "");
+ static_assert(
+ (std::is_same<C::const_reference, const std::allocator_traits<std::allocator<int>>::value_type&>::value), "");
static_assert((std::is_same<C::pointer, std::allocator_traits<std::allocator<int>>::pointer>::value), "");
- static_assert((std::is_same<C::const_pointer, std::allocator_traits<std::allocator<int>>::const_pointer>::value), "");
+ static_assert(
+ (std::is_same<C::const_pointer, std::allocator_traits<std::allocator<int>>::const_pointer>::value), "");
static_assert((std::is_signed<typename C::difference_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
diff --git a/libcxx/test/std/containers/sequences/vector/types.pass.cpp b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
index e1db70a806..f4d7fa0888 100644
--- a/libcxx/test/std/containers/sequences/vector/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
@@ -49,14 +49,22 @@ test()
// blindly pulling typedefs out of the allocator. This is why we can't call
// test<int, min_allocator<int>>() below.
static_assert((std::is_same<typename C::value_type, T>::value), "");
- static_assert((std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::value_type, typename std::allocator_traits<Allocator>::value_type>::value), "");
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
- static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
- static_assert((std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value), "");
- static_assert((std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
- static_assert((std::is_same<typename C::const_reference, const typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert(
+ (std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
+ static_assert(
+ (std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value),
+ "");
+ static_assert(
+ (std::is_same<typename C::reference, typename std::allocator_traits<Allocator>::value_type&>::value), "");
+ static_assert((std::is_same<typename C::const_reference,
+ const typename std::allocator_traits<Allocator>::value_type&>::value),
+ "");
static_assert((std::is_same<typename C::pointer, typename std::allocator_traits<Allocator>::pointer>::value), "");
- static_assert((std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
+ static_assert(
+ (std::is_same<typename C::const_pointer, typename std::allocator_traits<Allocator>::const_pointer>::value), "");
static_assert((std::is_signed<typename C::difference_type>::value), "");
static_assert((std::is_unsigned<typename C::size_type>::value), "");
``````````
</details>
https://github.com/llvm/llvm-project/pull/85806
More information about the libcxx-commits
mailing list