Skip to content

Commit 45d944d

Browse files
committed
Use local variable to work around LLVM/Clang bug
1 parent a644995 commit 45d944d

1 file changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From cb695ad7bf0193ef96d7de4e3bfd6b895ac81a59 Mon Sep 17 00:00:00 2001
2+
Message-ID: <cb695ad7bf0193ef96d7de4e3bfd6b895ac81a59.1713959468.git.stefan@agner.ch>
3+
From: Stefan Agner <stefan@agner.ch>
4+
Date: Wed, 24 Apr 2024 13:25:42 +0200
5+
Subject: [PATCH] Use local variable to work around macOS compiler bug
6+
7+
It seems that when directly passing the status, via inline condition
8+
etc. it triggers a compiler bug on the latest macOS ARM64 GitHub Action
9+
runners (Clang/LLVM (Homebrew) 15.0.7).
10+
11+
Use a local variable to work around the problem.
12+
---
13+
src/controller/python/chip/clusters/attribute.cpp | 7 ++++++-
14+
1 file changed, 6 insertions(+), 1 deletion(-)
15+
16+
diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp
17+
index e31f3431b8..4ba77ff58a 100644
18+
--- a/src/controller/python/chip/clusters/attribute.cpp
19+
+++ b/src/controller/python/chip/clusters/attribute.cpp
20+
@@ -168,6 +168,8 @@ public:
21+
uint8_t buffer[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE];
22+
uint32_t size = 0;
23+
CHIP_ERROR err = CHIP_NO_ERROR;
24+
+ Protocols::InteractionModel::Status status = Protocols::InteractionModel::Status::Success;
25+
+
26+
// When the apData is nullptr, means we did not receive a valid event data from server, status will be some error
27+
// status.
28+
if (apData != nullptr)
29+
@@ -195,11 +197,14 @@ public:
30+
this->OnError(err);
31+
}
32+
33+
+ if (apStatus != nullptr)
34+
+ status = apStatus->mStatus;
35+
+
36+
gOnReadEventDataCallback(
37+
mAppContext, aEventHeader.mPath.mEndpointId, aEventHeader.mPath.mClusterId, aEventHeader.mPath.mEventId,
38+
aEventHeader.mEventNumber, to_underlying(aEventHeader.mPriorityLevel), aEventHeader.mTimestamp.mValue,
39+
to_underlying(aEventHeader.mTimestamp.mType), buffer, size,
40+
- to_underlying(apStatus == nullptr ? Protocols::InteractionModel::Status::Success : apStatus->mStatus));
41+
+ to_underlying(status));
42+
}
43+
44+
void OnError(CHIP_ERROR aError) override { gOnReadErrorCallback(mAppContext, ToPyChipError(aError)); }
45+
--
46+
2.44.0
47+

0 commit comments

Comments
 (0)