[libc++] Remove std::function in C++03

We've said that we'll remove `std::function` from C++03 in LLVM 16, so we might as well do it now before we forget.

Reviewed By: ldionne, #libc, Mordante

Spies: jloser, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D135868
This commit is contained in:
Nikolas Klauser 2022-10-19 11:07:34 +02:00
parent a398981fb0
commit dbe60caa92
31 changed files with 59 additions and 1684 deletions

View File

@ -87,6 +87,9 @@ Deprecations and Removals
the C++23 paper that makes these functions ``constexpr``, therefore the
extension has been removed.
- The ``_LIBCPP_ENABLE_CXX03_FUNCTION`` macro that allowed re-enabling the now-deprecated C++03 implementation of
``std::function`` has been removed. Users who need to use ``std::function`` should switch to C++11 and above.
Upcoming Deprecations and Removals
----------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <functional>
// Check that libc++'s emulation of std::function is deprecated in C++03
// REQUIRES: c++03
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include "test_macros.h"
int main(int, char**) {
// Note:
// We use sizeof() to require it to be a complete type. We don't create a
// variable because otherwise we get two warnings for each variable (the
// second warning is when the destructor is implicitly called).
(void)sizeof(std::function<void ()>); // expected-warning {{'function<void ()>' is deprecated}}
(void)sizeof(std::function<void (int)>); // expected-warning {{'function<void (int)>' is deprecated}}
(void)sizeof(std::function<void (int, int)>); // expected-warning {{'function<void (int, int)>' is deprecated}}
(void)sizeof(std::function<void (int, int, int)>); // expected-warning {{'function<void (int, int, int)>' is deprecated}}
return 0;
}

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(function &&);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -8,6 +8,8 @@
// <streambuf>
// UNSUPPORTED: c++03
// template <class charT, class traits = char_traits<charT> >
// class basic_streambuf;

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// Class bad_function_call
// class bad_function_call

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// Class bad_function_call
// bad_function_call();

View File

@ -6,13 +6,12 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
// Make sure we can use std::function with a type that has a hostile overload
// of operator&().

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -13,9 +15,6 @@
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cstdlib>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// explicit operator bool() const
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>
#include <type_traits>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function(F);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -15,9 +17,6 @@
// && Convertible<Callable<F, ArgTypes...>::result_type
// operator=(F f);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -14,9 +16,6 @@
// Allow incomplete argument types in the __is_callable check
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -15,9 +17,6 @@
// Ensure that __not_null works for all function types.
// See https://llvm.org/PR23589
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
//------------------------------------------------------------------------------
// TESTING std::function<...>::__not_null(Callable)
//

View File

@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// <functional>
// REQUIRES: c++03 || c++11 || c++14
// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
@ -15,9 +15,6 @@
//
// This signature was removed in C++17
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
// <functional>
// REQUIRES: c++03 || c++11 || c++14
// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
// template<class F, class A> function(allocator_arg_t, const A&, F);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -7,15 +7,12 @@
//===----------------------------------------------------------------------===//
// <functional>
// REQUIRES: c++03 || c++11 || c++14
// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
// template<class A> function(allocator_arg_t, const A&, const function&);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// <functional>
// REQUIRES: c++03 || c++11 || c++14
// REQUIRES: c++11 || c++14
// class function<R(ArgTypes...)>
@ -15,9 +15,6 @@
//
// This signature was removed in C++17
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(const function& f);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <cassert>
#include <functional>
#include <utility>

View File

@ -10,6 +10,8 @@
// allocations.
// XFAIL: target=x86_64-pc-windows-msvc && stdlib=libc++
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -17,9 +19,6 @@
// function(const function& f);
// function(function&& f); // noexcept in C++20
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <memory>
#include <cstdlib>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function();
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -13,9 +15,6 @@
// template<class F, class A> void assign(F&&, const A&);
// This call was removed post-C++14
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// void swap(function& other);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -22,9 +24,6 @@
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <cassert>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
@ -19,9 +21,6 @@
// const T*
// target() const;
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
// UNSUPPORTED: no-rtti
#include <functional>

View File

@ -6,15 +6,14 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// class function<R(ArgTypes...)>
// const std::type_info& target_type() const;
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
// UNSUPPORTED: no-rtti
#include <functional>

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// <functional>
// template<Returnable R, CopyConstructible... ArgTypes>
@ -21,9 +23,6 @@
// ...
// };
// This test runs in C++03, but we have deprecated using std::function in C++03.
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX03_FUNCTION
#include <functional>
#include <type_traits>