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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@375307 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config index ee7351e..1ae2fdc 100644 --- a/include/__config +++ b/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/include/type_traits b/include/type_traits index 77dcc23..77b57a4 100644 --- a/include/type_traits +++ b/include/type_traits
@@ -1119,8 +1119,12 @@ 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))
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp index 2128590..595989c 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/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