forked from OSchip/llvm-project
P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of is_invocable that would internally conjure up a deprecated function type.
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings. Reviewers: mclow.lists, EricWF Subscribers: christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68879 llvm-svn: 375307
This commit is contained in:
parent
974c8b7e2f
commit
a9727033fb
|
@ -963,6 +963,20 @@ typedef unsigned int char32_t;
|
|||
# define _LIBCPP_DEPRECATED_IN_CXX17
|
||||
#endif
|
||||
|
||||
// Macros to enter and leave a state where deprecation warnings are suppressed.
|
||||
#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
|
||||
(defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
|
||||
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated\"")
|
||||
# define _LIBCPP_SUPPRESS_DEPRECATED_POP \
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH)
|
||||
# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
# define _LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
# define _LIBCPP_EXPLICIT_AFTER_CXX11
|
||||
#else
|
||||
|
|
|
@ -1119,8 +1119,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference
|
|||
template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
|
||||
#endif
|
||||
|
||||
// Suppress deprecation notice for volatile-qualified return type resulting
|
||||
// from volatile-qualified types _Tp.
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Tp> _Tp&& __declval(int);
|
||||
template <class _Tp> _Tp __declval(long);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Tp>
|
||||
decltype(_VSTD::__declval<_Tp>(0))
|
||||
|
|
|
@ -55,6 +55,9 @@ void test_result_of_imp()
|
|||
#endif
|
||||
}
|
||||
|
||||
// Do not warn on deprecated uses of 'volatile' below.
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
|
@ -171,3 +174,5 @@ int main(int, char**)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
|
|
@ -24,7 +24,7 @@ volatile int counter;
|
|||
double try1(bool v) {
|
||||
double a = get(0);
|
||||
double b = get(1);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b;
|
||||
|
@ -34,7 +34,7 @@ double try2(bool v) {
|
|||
double a = get(0);
|
||||
double b = get(1);
|
||||
double c = get(2);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b + c;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c;
|
||||
|
@ -45,7 +45,7 @@ double try3(bool v) {
|
|||
double b = get(1);
|
||||
double c = get(2);
|
||||
double d = get(3);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b + c + d;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d;
|
||||
|
@ -57,7 +57,7 @@ double try4(bool v) {
|
|||
double c = get(0);
|
||||
double d = get(0);
|
||||
double e = get(0);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b+c+d+e;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d+e;
|
||||
|
@ -70,7 +70,7 @@ double try5(bool v) {
|
|||
double d = get(0);
|
||||
double e = get(0);
|
||||
double f = get(0);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b+c+d+e+f;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d+e+f;
|
||||
|
@ -84,7 +84,7 @@ double try6(bool v) {
|
|||
double e = get(0);
|
||||
double f = get(0);
|
||||
double g = get(0);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b+c+d+e+f+g;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d+e+f+g;
|
||||
|
@ -99,7 +99,7 @@ double try7(bool v) {
|
|||
double f = get(0);
|
||||
double g = get(0);
|
||||
double h = get(0);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b+c+d+e+f+g+h;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d+e+f+g+h;
|
||||
|
@ -115,7 +115,7 @@ double try8(bool v) {
|
|||
double g = get(0);
|
||||
double h = get(0);
|
||||
double i = get(0);
|
||||
for (counter = 100; counter; --counter)
|
||||
for (counter = 100; counter; counter = counter - 1)
|
||||
a += get(1) + b+c+d+e+f+g+h+i;
|
||||
if (v) throw 10;
|
||||
return get(0)+a+b+c+d+e+f+g+h+i;
|
||||
|
|
Loading…
Reference in New Issue