[libc++] Add deprecated attributes to many deprecated components
Summary: These deprecation warnings are opt-in: they are only enabled when the _LIBCXX_DEPRECATION_WARNINGS macro is defined, which is not the case by default. Note that this is a first step in the right direction, but I wasn't able to get an exhaustive list of all deprecated components per standard, so there's certainly stuff that's missing. The list of components this commit marks as deprecated is: in C++11: - auto_ptr, auto_ptr_ref - binder1st, binder2nd, bind1st(), bind2nd() - pointer_to_unary_function, pointer_to_binary_function, ptr_fun() - mem_fun_t, mem_fun1_t, const_mem_fun_t, const_mem_fun1_t, mem_fun() - mem_fun_ref_t, mem_fun1_ref_t, const_mem_fun_ref_t, const_mem_fun1_ref_t, mem_fun_ref() in C++14: - random_shuffle() in C++17: - unary_negate, binary_negate, not1(), not2() <rdar://problem/18168350> Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48912 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342843 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
|
||||
// binary_negate
|
||||
// deprecated in C++17
|
||||
|
||||
// REQUIRES: verify-support
|
||||
|
||||
// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Predicate {
|
||||
typedef int first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
bool operator()(first_argument_type, second_argument_type) const { return true; }
|
||||
};
|
||||
|
||||
int main() {
|
||||
#if TEST_STD_VER < 17
|
||||
// expected-no-diagnostics
|
||||
#else
|
||||
// expected-error@* 1 {{'binary_negate<Predicate>' is deprecated}}
|
||||
#endif
|
||||
std::binary_negate<Predicate> f((Predicate()));
|
||||
(void)f;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
|
||||
// not1
|
||||
// deprecated in C++17
|
||||
|
||||
// REQUIRES: verify-support
|
||||
|
||||
// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Predicate {
|
||||
typedef int argument_type;
|
||||
bool operator()(argument_type) const { return true; }
|
||||
};
|
||||
|
||||
int main() {
|
||||
#if TEST_STD_VER < 17
|
||||
// expected-no-diagnostics
|
||||
#else
|
||||
// expected-error@* 1 {{'not1<Predicate>' is deprecated}}
|
||||
#endif
|
||||
std::not1(Predicate());
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
|
||||
// not2
|
||||
// deprecated in C++17
|
||||
|
||||
// REQUIRES: verify-support
|
||||
|
||||
// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Predicate {
|
||||
typedef int first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
bool operator()(first_argument_type, second_argument_type) const { return true; }
|
||||
};
|
||||
|
||||
int main() {
|
||||
#if TEST_STD_VER < 17
|
||||
// expected-no-diagnostics
|
||||
#else
|
||||
// expected-error@* 1 {{'not2<Predicate>' is deprecated}}
|
||||
#endif
|
||||
std::not2(Predicate());
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
|
||||
// unary_negate
|
||||
// deprecated in C++17
|
||||
|
||||
// REQUIRES: verify-support
|
||||
|
||||
// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Predicate {
|
||||
typedef int argument_type;
|
||||
bool operator()(argument_type) const { return true; }
|
||||
};
|
||||
|
||||
int main() {
|
||||
#if TEST_STD_VER < 17
|
||||
// expected-no-diagnostics
|
||||
#else
|
||||
// expected-error@* 1 {{'unary_negate<Predicate>' is deprecated}}
|
||||
#endif
|
||||
std::unary_negate<Predicate> f((Predicate()));
|
||||
(void)f;
|
||||
}
|
||||
Reference in New Issue
Block a user