diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -963,6 +963,20 @@ # 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 diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -1119,8 +1119,11 @@ template using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; #endif +// Suppress deprecation notice for volatile-qualified return type. +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template _Tp&& __declval(int); template _Tp __declval(long); +_LIBCPP_SUPPRESS_DEPRECATED_POP template decltype(_VSTD::__declval<_Tp>(0)) diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp @@ -55,6 +55,9 @@ #endif } +// Do not warn on deprecated uses of 'volatile' below. +_LIBCPP_SUPPRESS_DEPRECATED_PUSH + int main(int, char**) { { @@ -171,3 +174,5 @@ return 0; } + +_LIBCPP_SUPPRESS_DEPRECATED_POP diff --git a/libcxxabi/test/unwind_06.pass.cpp b/libcxxabi/test/unwind_06.pass.cpp --- a/libcxxabi/test/unwind_06.pass.cpp +++ b/libcxxabi/test/unwind_06.pass.cpp @@ -24,7 +24,7 @@ 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 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 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 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 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 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 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 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;