Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG

llvm-svn: 291278
This commit is contained in:
Eric Fiselier 2017-01-06 20:58:25 +00:00
parent b6c6eaf226
commit 8f56dedb5f
12 changed files with 79 additions and 50 deletions

View File

@ -275,10 +275,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // !(__has_feature(cxx_deleted_functions))
#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif
@ -431,7 +427,6 @@ namespace std {
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
@ -448,7 +443,6 @@ namespace std {
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@ -483,7 +477,6 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#if _MSC_VER <= 1800
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#endif
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
@ -739,7 +732,7 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DEFAULT = default;
#endif
#ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifdef _LIBCPP_CXX03_LANG
#define _LIBCPP_EQUAL_DELETE
#else
#define _LIBCPP_EQUAL_DELETE = delete

View File

@ -122,7 +122,7 @@ struct _LIBCPP_TYPE_VIS __i_node
__i_node* __next_;
__c_node* __c_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
#else
@ -145,7 +145,7 @@ struct _LIBCPP_TYPE_VIS __c_node
__i_node** end_;
__i_node** cap_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
#else
@ -232,7 +232,7 @@ class _LIBCPP_TYPE_VIS __libcpp_db
__libcpp_db();
public:
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
#else

View File

@ -552,23 +552,10 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif
#if _LIBCPP_STD_VER > 11
template <class _Tp1, class _Tp2 = void>

View File

@ -943,16 +943,16 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {}
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#else
private:
__atomic_base(const __atomic_base&);
__atomic_base& operator=(const __atomic_base&);
__atomic_base& operator=(const __atomic_base&) volatile;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif
};
#if defined(__cpp_lib_atomic_is_always_lock_free)
@ -1699,16 +1699,16 @@ typedef struct atomic_flag
_LIBCPP_INLINE_VISIBILITY
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#else
private:
atomic_flag(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&) volatile;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif
} atomic_flag;
inline _LIBCPP_INLINE_VISIBILITY

View File

@ -205,14 +205,9 @@ protected:
basic_ios<char_type, traits_type>::swap(__rhs);
}
#if _LIBCPP_STD_VER > 11
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
basic_istream (const basic_istream& __rhs) = delete;
basic_istream& operator=(const basic_istream& __rhs) = delete;
#else
basic_istream (const basic_istream& __rhs); // not defined
basic_istream& operator=(const basic_istream& __rhs); // not defined
#endif
#endif
public:

View File

@ -179,7 +179,7 @@ protected:
void swap(basic_ostream& __rhs)
{ basic_ios<char_type, traits_type>::swap(__rhs); }
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
basic_ostream (const basic_ostream& __rhs) = delete;
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
#else

View File

@ -489,7 +489,7 @@ addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
}
#endif
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DELETED_FUNCTIONS)
#if !defined(_LIBCPP_CXX03_LANG)
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
#endif
@ -1566,7 +1566,7 @@ struct __type_list
struct __nat
{
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#ifndef _LIBCPP_CXX03_LANG
__nat() = delete;
__nat(const __nat&) = delete;
__nat& operator=(const __nat&) = delete;

View File

@ -25,9 +25,10 @@
#include <vector>
#include <initializer_list>
#include "test_macros.h"
#include "test_iterators.h"
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION

View File

@ -0,0 +1,55 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >
// class basic_istream;
// basic_istream(basic_istream const& rhs) = delete;
// basic_istream& operator=(basic_istream const&) = delete;
#include <istream>
#include <type_traits>
#include <cassert>
struct test_istream
: public std::basic_istream<char>
{
typedef std::basic_istream<char> base;
test_istream(test_istream&& s)
: base(std::move(s)) // OK
{
}
test_istream& operator=(test_istream&& s) {
base::operator=(std::move(s)); // OK
return *this;
}
test_istream(test_istream const& s)
: base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}}
{
}
test_istream& operator=(test_istream const& s) {
base::operator=(s); // expected-error {{call to deleted member function 'operator='}}
return *this;
}
};
int main()
{
}

View File

@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <istream>
// template <class charT, class traits = char_traits<charT> >
@ -17,8 +19,6 @@
#include <istream>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@ -37,11 +37,8 @@ struct test_istream
: base(std::move(s)) {}
};
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
testbuf<char> sb;
test_istream<char> is1(&sb);
@ -74,5 +71,4 @@ int main()
assert(is.precision() == 6);
assert(is.getloc().name() == "C");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}

View File

@ -19,7 +19,9 @@
#include <type_traits>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#include "test_macros.h"
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION { assert(false); }

View File

@ -17,7 +17,7 @@
#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION