summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-24 08:00:23 +0100
committerGitHub <noreply@github.com>2020-02-24 08:00:23 +0100
commit128a55a597b0dfad4d7f5b94c64b37b0ce120899 (patch)
tree06cb54f7a9df6bb015f8c5c416f19c200c66eb8b /core
parent49118315ba2cbc153384fd733784250abe053b6d (diff)
parent15e6a82faff0bf9a08def1e46f2e9a8c4e0ac3ea (diff)
Merge pull request #36494 from akien-mga/callable-fixes
Fix some signals and non-debug branch for callable_mp
Diffstat (limited to 'core')
-rw-r--r--core/callable_method_pointer.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/callable_method_pointer.h b/core/callable_method_pointer.h
index fed793dfca..a931a344e6 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<P>::cast(p_args, Is, r_error)...);
#else
- (p_instance->*p_method)(VariantCaster<P...>::cast(p_args[Is])...);
+ (p_instance->*p_method)(VariantCaster<P>::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 <class T, class R, class... P, size_t... Is>
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<Is...>) {
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<P>::cast(p_args, Is, r_error)...);
#else
- (p_instance->*p_method)(VariantCaster<P...>::cast(p_args[Is])...);
+ (p_instance->*p_method)(VariantCaster<P>::cast(p_args[Is])...);
#endif
}
+#if defined(DEBUG_METHODS_ENABLED) && defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
template <class T, class R, class... P>
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