From: David Wells Date: Wed, 22 Jun 2022 17:35:17 +0000 (-0400) Subject: Get rid of some warnings from defining Threads::new_thread(). X-Git-Tag: v9.5.0-rc1~1175^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14035%2Fhead;p=dealii.git 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. --- 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 -------------------------------------