From d0c519d6344576ab256011c7e57d6f06fa677d3e Mon Sep 17 00:00:00 2001 From: Curtis Rahman Date: Mon, 6 May 2024 11:21:11 -0400 Subject: [PATCH 1/5] Added NDEBUG ifndef to minimize code size --- examples/light-switch-app/silabs/src/ZclCallbacks.cpp | 3 +++ examples/lock-app/silabs/src/ZclCallbacks.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp index 52542ca88fb390..d83e5380d682b0 100644 --- a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp @@ -30,6 +30,7 @@ using namespace ::chip; using namespace ::chip::app::Clusters; +#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { @@ -50,6 +51,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ChipLogValueMEI(attributeId), type, *value, size); } } +#ifndef NDEBUG + /** @brief OnOff Cluster Init * diff --git a/examples/lock-app/silabs/src/ZclCallbacks.cpp b/examples/lock-app/silabs/src/ZclCallbacks.cpp index 1c0c1efab19dde..ae6b22bf19c080 100644 --- a/examples/lock-app/silabs/src/ZclCallbacks.cpp +++ b/examples/lock-app/silabs/src/ZclCallbacks.cpp @@ -39,6 +39,7 @@ using namespace ::chip::app::Clusters; using namespace ::chip::DeviceLayer::Internal; using ::chip::app::DataModel::Nullable; +#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { @@ -56,6 +57,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & #endif // DIC_ENABLE } } +#endif // NDEBUG /** @brief DoorLock Cluster Init * From 0f342e010c7a7930be263bd6f97d2751202e0a68 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 6 May 2024 15:27:13 +0000 Subject: [PATCH 2/5] Restyled by whitespace --- examples/light-switch-app/silabs/src/ZclCallbacks.cpp | 4 ++-- examples/lock-app/silabs/src/ZclCallbacks.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp index d83e5380d682b0..a1e7d56b9127c7 100644 --- a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp @@ -30,7 +30,7 @@ using namespace ::chip; using namespace ::chip::app::Clusters; -#ifndef NDEBUG +#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { @@ -51,7 +51,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ChipLogValueMEI(attributeId), type, *value, size); } } -#ifndef NDEBUG +#ifndef NDEBUG /** @brief OnOff Cluster Init diff --git a/examples/lock-app/silabs/src/ZclCallbacks.cpp b/examples/lock-app/silabs/src/ZclCallbacks.cpp index ae6b22bf19c080..0fb6cfe4062823 100644 --- a/examples/lock-app/silabs/src/ZclCallbacks.cpp +++ b/examples/lock-app/silabs/src/ZclCallbacks.cpp @@ -39,7 +39,7 @@ using namespace ::chip::app::Clusters; using namespace ::chip::DeviceLayer::Internal; using ::chip::app::DataModel::Nullable; -#ifndef NDEBUG +#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { From e17b263dc2570e76f2e9d5523d08563e454e9c40 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 6 May 2024 15:27:17 +0000 Subject: [PATCH 3/5] Restyled by clang-format --- examples/light-switch-app/silabs/src/ZclCallbacks.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp index a1e7d56b9127c7..bfe88360f760ea 100644 --- a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp @@ -53,7 +53,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & } #ifndef NDEBUG - /** @brief OnOff Cluster Init * * This function is called when a specific cluster is initialized. It gives the From 806d22fe6e9953ec4b929a5ea438e9a216bbbdb2 Mon Sep 17 00:00:00 2001 From: Curtis Rahman Date: Mon, 6 May 2024 13:58:41 -0400 Subject: [PATCH 4/5] Added #endif --- examples/light-switch-app/silabs/src/ZclCallbacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp index bfe88360f760ea..50a3b109902f5f 100644 --- a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp @@ -51,7 +51,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ChipLogValueMEI(attributeId), type, *value, size); } } -#ifndef NDEBUG +#endif /** @brief OnOff Cluster Init * From 69a07e88b0e0a03aed28a9bd73cf11080ba1b022 Mon Sep 17 00:00:00 2001 From: Curtis Rahman Date: Mon, 6 May 2024 16:54:17 -0400 Subject: [PATCH 5/5] Added [[mayne_unused]] --- examples/light-switch-app/silabs/src/ZclCallbacks.cpp | 6 ++---- examples/lock-app/silabs/src/ZclCallbacks.cpp | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp index 50a3b109902f5f..13375537556067 100644 --- a/examples/light-switch-app/silabs/src/ZclCallbacks.cpp +++ b/examples/light-switch-app/silabs/src/ZclCallbacks.cpp @@ -30,12 +30,11 @@ using namespace ::chip; using namespace ::chip::app::Clusters; -#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { - ClusterId clusterId = attributePath.mClusterId; - AttributeId attributeId = attributePath.mAttributeId; + ClusterId clusterId = attributePath.mClusterId; + [[maybe_unused]] AttributeId attributeId = attributePath.mAttributeId; ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); if (clusterId == OnOffSwitchConfiguration::Id) @@ -51,7 +50,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ChipLogValueMEI(attributeId), type, *value, size); } } -#endif /** @brief OnOff Cluster Init * diff --git a/examples/lock-app/silabs/src/ZclCallbacks.cpp b/examples/lock-app/silabs/src/ZclCallbacks.cpp index 0fb6cfe4062823..2aa0e9d0f6cef2 100644 --- a/examples/lock-app/silabs/src/ZclCallbacks.cpp +++ b/examples/lock-app/silabs/src/ZclCallbacks.cpp @@ -39,7 +39,6 @@ using namespace ::chip::app::Clusters; using namespace ::chip::DeviceLayer::Internal; using ::chip::app::DataModel::Nullable; -#ifndef NDEBUG void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) { @@ -49,7 +48,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & if (clusterId == DoorLock::Id && attributeId == DoorLock::Attributes::LockState::Id) { - DoorLock::DlLockState lockState = *(reinterpret_cast(value)); + [[maybe_unused]] DoorLock::DlLockState lockState = *(reinterpret_cast(value)); ChipLogProgress(Zcl, "Door lock cluster: " ChipLogFormatMEI " state %d", ChipLogValueMEI(clusterId), to_underlying(lockState)); #ifdef DIC_ENABLE @@ -57,7 +56,6 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & #endif // DIC_ENABLE } } -#endif // NDEBUG /** @brief DoorLock Cluster Init *