From 7fba438aea69a843af1d7a59ccc967a56001d67a Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 22 Jun 2022 13:35:17 -0400 Subject: [PATCH] Get rid of some warnings from defining Threads::new_thread(). This function calls a deprecated constructor but it itself is deprecated, so this isn't all that helpful of a message. We presently see this warning printed out whenever we compile examples that include this header on Debian 11. --- include/deal.II/base/thread_management.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/deal.II/base/thread_management.h b/include/deal.II/base/thread_management.h index a42babc246..fd8e2d12a6 100644 --- a/include/deal.II/base/thread_management.h +++ b/include/deal.II/base/thread_management.h @@ -759,7 +759,13 @@ namespace Threads DEAL_II_DEPRECATED inline Thread new_thread(const std::function &function) { + // Here and below we need to disable deprecation warnings for calling the + // constructor in this function - as this function itself is deprecated + // these warnings are not helpful. This problem only appears in some + // configurations (e.g., Debian 11 with GCC-10). + DEAL_II_DISABLE_EXTRA_DIAGNOSTICS return Thread(function); + DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } @@ -835,8 +841,11 @@ namespace Threads new_thread(FunctionObjectType function_object) -> Thread { + // See the comment in the first new_thread() implementation + DEAL_II_DISABLE_EXTRA_DIAGNOSTICS using return_type = decltype(function_object()); return Thread(std::function(function_object)); + DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } @@ -853,9 +862,12 @@ namespace Threads DEAL_II_DEPRECATED inline Thread new_thread(RT (*fun_ptr)(Args...), typename identity::type... args) { + // See the comment in the first new_thread() implementation + DEAL_II_DISABLE_EXTRA_DIAGNOSTICS auto dummy = std::make_tuple(internal::maybe_make_ref::act(args)...); return new_thread( [dummy, fun_ptr]() -> RT { return std_cxx17::apply(fun_ptr, dummy); }); + DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } @@ -891,9 +903,12 @@ namespace Threads typename identity::type &c, typename identity::type... args) { + // See the comment in the first new_thread() implementation + DEAL_II_DISABLE_EXTRA_DIAGNOSTICS // NOLINTNEXTLINE(modernize-avoid-bind) silence clang-tidy return new_thread(std::function(std::bind( fun_ptr, std::cref(c), internal::maybe_make_ref::act(args)...))); + DEAL_II_ENABLE_EXTRA_DIAGNOSTICS } // ------------------------ ThreadGroup ------------------------------------- -- 2.39.5