From 56be65c839fc3167d1c1255aaa53119d1fee394e Mon Sep 17 00:00:00 2001 From: fesseha-eve <88329315+fessehaeve@users.noreply.github.com> Date: Mon, 7 Feb 2022 17:39:12 +0100 Subject: [PATCH] Put temporary fix for function pointer casting error in arm gcc (#14830) * Put temporary fix for function pointer casting error in arm gcc * Restyle and add comment to prevent future unintended change --- src/app/util/attribute-storage.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 7e2b07f0b81e14..1b8180dc9f64c5 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -371,11 +371,14 @@ EmberAfStatus emAfClusterPreAttributeChangedCallback(const app::ConcreteAttribut } else { - EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; - EmberAfGenericClusterFunction f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION); + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + // Casting and calling a function pointer on the same line results in ignoring the return + // of the call on gcc-arm-none-eabi-9-2019-q4-major + EmberAfClusterPreAttributeChangedCallback f = (EmberAfClusterPreAttributeChangedCallback)( + emberAfFindClusterFunction(cluster, CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION)); if (f != NULL) { - status = ((EmberAfClusterPreAttributeChangedCallback) f)(attributePath, attributeType, size, value); + status = f(attributePath, attributeType, size, value); } return status; }