Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 783ae43

Browse files
committed
Wrap friend decls w/ parens for clang workaround
Clang has an issue interpreting these friend declarations. However, it can properly parse the declarations if explicitly delimited by parentheses.
1 parent ded21fc commit 783ae43

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/adaptations/device-layer/include/Weave/DeviceLayer/ConfigurationManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ class ConfigurationManager
140140
template<class> friend class ::nl::Weave::DeviceLayer::Internal::GenericPlatformManagerImpl;
141141
friend class ::nl::Weave::DeviceLayer::TraitManager;
142142
friend class ::nl::Weave::DeviceLayer::Internal::DeviceControlServer;
143-
friend WEAVE_ERROR ::nl::Weave::Platform::PersistedStorage::Read(::nl::Weave::Platform::PersistedStorage::Key key, uint32_t & value);
144-
friend WEAVE_ERROR ::nl::Weave::Platform::PersistedStorage::Write(::nl::Weave::Platform::PersistedStorage::Key key, uint32_t value);
143+
// Parentheses used to fix clang parsing issue with these declarations
144+
friend WEAVE_ERROR (::nl::Weave::Platform::PersistedStorage::Read(::nl::Weave::Platform::PersistedStorage::Key key, uint32_t & value));
145+
friend WEAVE_ERROR (::nl::Weave::Platform::PersistedStorage::Write(::nl::Weave::Platform::PersistedStorage::Key key, uint32_t value));
145146

146147
using ImplClass = ConfigurationManagerImpl;
147148

src/adaptations/device-layer/include/Weave/DeviceLayer/PlatformManager.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ class PlatformManager
9090
template<class> friend class Internal::GenericThreadStackManagerImpl_OpenThread;
9191
template<class> friend class Internal::GenericThreadStackManagerImpl_OpenThread_LwIP;
9292
template<class> friend class Internal::GenericConfigurationManagerImpl;
93-
friend ::nl::Weave::System::Error ::nl::Weave::System::Platform::Layer::PostEvent(::nl::Weave::System::Layer & aLayer, void * aContext, ::nl::Weave::System::Object & aTarget, ::nl::Weave::System::EventType aType, uintptr_t aArgument);
94-
friend ::nl::Weave::System::Error ::nl::Weave::System::Platform::Layer::DispatchEvents(::nl::Weave::System::Layer & aLayer, void * aContext);
95-
friend ::nl::Weave::System::Error ::nl::Weave::System::Platform::Layer::DispatchEvent(::nl::Weave::System::Layer & aLayer, void * aContext, ::nl::Weave::System::Event aEvent);
96-
friend ::nl::Weave::System::Error ::nl::Weave::System::Platform::Layer::StartTimer(::nl::Weave::System::Layer & aLayer, void * aContext, uint32_t aMilliseconds);
93+
// Parentheses used to fix clang parsing issue with these declarations
94+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::PostEvent(::nl::Weave::System::Layer & aLayer, void * aContext, ::nl::Weave::System::Object & aTarget, ::nl::Weave::System::EventType aType, uintptr_t aArgument));
95+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::DispatchEvents(::nl::Weave::System::Layer & aLayer, void * aContext));
96+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::DispatchEvent(::nl::Weave::System::Layer & aLayer, void * aContext, ::nl::Weave::System::Event aEvent));
97+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::StartTimer(::nl::Weave::System::Layer & aLayer, void * aContext, uint32_t aMilliseconds));
9798

9899
void PostEvent(const WeaveDeviceEvent * event);
99100
void DispatchEvent(const WeaveDeviceEvent * event);

0 commit comments

Comments
 (0)