From 220c8e834403006b2511e2af3c1b23942791f3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Feb 2020 18:49:21 +0100 Subject: [PATCH] callable_mp: Fix non-debug branch Was missed in #36393 because no `callable_mp()` calls were actually compiled with `tools=no` in that PR. Also work around GCC warning that also affects the `call_with_variant_args_ret_helper` variant. --- core/callable_method_pointer.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core/callable_method_pointer.h b/core/callable_method_pointer.h index fed793dfca7..a931a344e66 100644 --- a/core/callable_method_pointer.h +++ b/core/callable_method_pointer.h @@ -134,7 +134,7 @@ void call_with_variant_args_helper(T *p_instance, void (T::*p_method)(P...), con #ifdef DEBUG_METHODS_ENABLED (p_instance->*p_method)(VariantCasterAndValidate

::cast(p_args, Is, r_error)...); #else - (p_instance->*p_method)(VariantCaster::cast(p_args[Is])...); + (p_instance->*p_method)(VariantCaster

::cast(p_args[Is])...); #endif } @@ -201,6 +201,15 @@ Callable create_custom_callable_function_pointer(T *p_instance, // VERSION WITH RETURN +// GCC 8 raises "parameter 'p_args' set but not used" here, probably using a +// template version that does not have arguments and thus sees it unused, but +// obviously the template can be used for functions with and without them, and +// the optimizer will get rid of it anyway. +#if defined(DEBUG_METHODS_ENABLED) && defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-but-set-parameter" +#endif + template void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant &r_ret, Callable::CallError &r_error, IndexSequence) { r_error.error = Callable::CallError::CALL_OK; @@ -208,10 +217,14 @@ void call_with_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), co #ifdef DEBUG_METHODS_ENABLED r_ret = (p_instance->*p_method)(VariantCasterAndValidate

::cast(p_args, Is, r_error)...); #else - (p_instance->*p_method)(VariantCaster::cast(p_args[Is])...); + (p_instance->*p_method)(VariantCaster

::cast(p_args[Is])...); #endif } +#if defined(DEBUG_METHODS_ENABLED) && defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + template void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, int p_argcount, Variant &r_ret, Callable::CallError &r_error) { #ifdef DEBUG_METHODS_ENABLED