[libc++][test] Use = delete over DELETE_FUNCTION. NFC.

Some tests repeat the definition of `DELETE_FUNCTION` macro locally.
However, it's not even requred to guard against in the C++03 case since
Clang supports `= delete;` in C++03 mode. A warning is issued but
`libc++` tests run with `-Wno-c++11-extensions`, so this isn't an issue.
Since we don't support other compilers in C++03 mode, `= delete;` is
always available for use. As such, inline all calls of `DELETE_FUNCTION`
to use `= delete;`.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D111148
This commit is contained in:
Joe Loser 2021-10-05 14:08:42 -04:00
parent d5a4c86d14
commit 8cf5319aff
No known key found for this signature in database
GPG Key ID: 1CDBEBC050EA230D
6 changed files with 16 additions and 50 deletions

View File

@ -35,12 +35,6 @@
#include <span>
#endif
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
#endif
class T; // incomplete
class my_input_iterator

View File

@ -18,12 +18,6 @@
#include "test_macros.h"
#include <MoveOnly.h>
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
#endif
int A_constructed = 0;
struct A
@ -36,7 +30,7 @@ public:
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
A* operator& () DELETE_FUNCTION;
A* operator& () = delete;
};
int main(int, char**)

View File

@ -21,12 +21,6 @@
#include "test_allocator.h"
#include "min_allocator.h"
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
#endif
int new_count = 0;
struct A
@ -42,7 +36,7 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
A* operator& () DELETE_FUNCTION;
A* operator& () = delete;
private:
int int_;
char char_;

View File

@ -18,12 +18,6 @@
#include "test_macros.h"
#include "count_new.h"
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
#endif
struct A
{
static int count;
@ -37,7 +31,7 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
A* operator& () DELETE_FUNCTION;
A* operator& () = delete;
private:
int int_;

View File

@ -419,10 +419,8 @@ public:
explicit limited_allocator(limited_allocator<U, N> const& other)
: handle_(other.handle_) {}
private:
limited_allocator& operator=(const limited_allocator&);// = delete;
limited_allocator& operator=(const limited_allocator&) = delete;
public:
pointer allocate(size_type n) { return handle_->template allocate<T>(n); }
void deallocate(pointer p, size_type n) { handle_->deallocate(p, n); }
size_type max_size() const {return N;}

View File

@ -16,12 +16,6 @@
#include "test_macros.h"
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION
#endif
template <class It>
class output_iterator
{
@ -49,7 +43,7 @@ public:
{output_iterator tmp(*this); ++(*this); return tmp;}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
// This is the Cpp17InputIterator requirement as described in Table 87 ([input.iterators]),
@ -88,7 +82,7 @@ public:
{return !(x == y);}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
template <class T, class TV, class U, class UV>
@ -136,7 +130,7 @@ public:
{return !(x == y);}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
template <class T, class U>
@ -187,7 +181,7 @@ public:
{return !(x == y);}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
template <class T, class U>
@ -236,7 +230,7 @@ public:
{bidirectional_iterator tmp(*this); --(*this); return tmp;}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
template <class T, class U>
@ -296,7 +290,7 @@ public:
TEST_CONSTEXPR_CXX14 reference operator[](difference_type n) const {return it_[n];}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
template <class T, class U>
@ -426,7 +420,7 @@ public:
}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
};
#endif
@ -553,7 +547,7 @@ struct ThrowingIterator {
}
template <class T2>
void operator,(T2 const &) DELETE_FUNCTION;
void operator,(T2 const &) = delete;
private:
const T* begin_;
@ -624,7 +618,7 @@ struct NonThrowingIterator {
}
template <class T2>
void operator,(T2 const &) DELETE_FUNCTION;
void operator,(T2 const &) = delete;
private:
const T *begin_;
@ -664,7 +658,7 @@ struct cpp20_input_iterator {
constexpr I base() && { return std::move(base_); }
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
private:
I base_ = I();
@ -853,7 +847,7 @@ public:
}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
private:
I base_;
@ -932,7 +926,7 @@ public:
constexpr reference operator[](difference_type n) const {return it_[n];}
template <class T>
void operator,(T const &) DELETE_FUNCTION;
void operator,(T const &) = delete;
friend constexpr
difference_type operator-(const three_way_contiguous_iterator& x, const three_way_contiguous_iterator& y) {
@ -944,6 +938,4 @@ public:
#endif // TEST_STD_VER > 17 && defined(__cpp_lib_concepts)
#undef DELETE_FUNCTION
#endif // SUPPORT_TEST_ITERATORS_H