[libcxx] r291278 - Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 6 12:58:25 PST 2017


Author: ericwf
Date: Fri Jan  6 14:58:25 2017
New Revision: 291278

URL: http://llvm.org/viewvc/llvm-project?rev=291278&view=rev
Log:
Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG

Added:
    libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/__debug
    libcxx/trunk/include/__functional_base
    libcxx/trunk/include/atomic
    libcxx/trunk/include/istream
    libcxx/trunk/include/ostream
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp
    libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
    libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
    libcxx/trunk/test/support/test_iterators.h

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Jan  6 14:58:25 2017
@@ -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 __attr
 #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_asse
 #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

Modified: libcxx/trunk/include/__debug
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__debug?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/__debug (original)
+++ libcxx/trunk/include/__debug Fri Jan  6 14:58:25 2017
@@ -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

Modified: libcxx/trunk/include/__functional_base
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__functional_base?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/__functional_base (original)
+++ libcxx/trunk/include/__functional_base Fri Jan  6 14:58:25 2017
@@ -552,23 +552,10 @@ cref(reference_wrapper<_Tp> __t) _NOEXCE
     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>

Modified: libcxx/trunk/include/atomic
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Fri Jan  6 14:58:25 2017
@@ -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

Modified: libcxx/trunk/include/istream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/istream?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/istream (original)
+++ libcxx/trunk/include/istream Fri Jan  6 14:58:25 2017
@@ -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:
 

Modified: libcxx/trunk/include/ostream
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ostream?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/ostream (original)
+++ libcxx/trunk/include/ostream Fri Jan  6 14:58:25 2017
@@ -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

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Fri Jan  6 14:58:25 2017
@@ -489,7 +489,7 @@ addressof(__unsafe_unretained _Tp& __x)
 }
 #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;

Modified: libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp Fri Jan  6 14:58:25 2017
@@ -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

Added: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp?rev=291278&view=auto
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp (added)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp Fri Jan  6 14:58:25 2017
@@ -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()
+{
+
+}

Modified: libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp Fri Jan  6 14:58:25 2017
@@ -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
 }

Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h (original)
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h Fri Jan  6 14:58:25 2017
@@ -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); }

Modified: libcxx/trunk/test/support/test_iterators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_iterators.h?rev=291278&r1=291277&r2=291278&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_iterators.h (original)
+++ libcxx/trunk/test/support/test_iterators.h Fri Jan  6 14:58:25 2017
@@ -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




More information about the cfe-commits mailing list