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

Commit 6aabfe6

Browse files
authored
Merge pull request #474 from jasongraffius/master
Fixes for clang build in Device Layer
2 parents 51da490 + 64230fe commit 6aabfe6

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

src/adaptations/device-layer/GeneralUtils.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ WEAVE_ERROR ParseCompilerDateStr(const char * dateStr, uint16_t & year, uint8_t
3131
{
3232
WEAVE_ERROR err = WEAVE_NO_ERROR;
3333
char monthStr[4];
34-
char * p;
34+
const char * p;
35+
char* endptr;
3536

3637
static const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
3738

@@ -45,11 +46,11 @@ WEAVE_ERROR ParseCompilerDateStr(const char * dateStr, uint16_t & year, uint8_t
4546

4647
month = ((p - months) / 3) + 1;
4748

48-
dayOfMonth = strtoul(dateStr + 4, &p, 10);
49-
VerifyOrExit(p == dateStr + 6, err = WEAVE_ERROR_INVALID_ARGUMENT);
49+
dayOfMonth = strtoul(dateStr + 4, &endptr, 10);
50+
VerifyOrExit(endptr == dateStr + 6, err = WEAVE_ERROR_INVALID_ARGUMENT);
5051

51-
year = strtoul(dateStr + 7, &p, 10);
52-
VerifyOrExit(p == dateStr + 11, err = WEAVE_ERROR_INVALID_ARGUMENT);
52+
year = strtoul(dateStr + 7, &endptr, 10);
53+
VerifyOrExit(endptr == dateStr + 11, err = WEAVE_ERROR_INVALID_ARGUMENT);
5354

5455
exit:
5556
return err;

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: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828

2929
namespace nl {
3030
namespace Weave {
31+
namespace System {
32+
namespace Platform {
33+
namespace Layer {
34+
35+
System::Error PostEvent(System::Layer&, void*, System::Object&, System::EventType, uintptr_t);
36+
System::Error DispatchEvents(System::Layer&, void*);
37+
System::Error DispatchEvent(System::Layer&, void*, System::Event);
38+
System::Error StartTimer(System::Layer&, void*, uint32_t);
39+
40+
} // namespace Layer
41+
} // namespace Platform
42+
} // namespace System
43+
3144
namespace DeviceLayer {
3245

3346
class PlatformManagerImpl;
@@ -90,10 +103,11 @@ class PlatformManager
90103
template<class> friend class Internal::GenericThreadStackManagerImpl_OpenThread;
91104
template<class> friend class Internal::GenericThreadStackManagerImpl_OpenThread_LwIP;
92105
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);
106+
// Parentheses used to fix clang parsing issue with these declarations
107+
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));
108+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::DispatchEvents(::nl::Weave::System::Layer & aLayer, void * aContext));
109+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::DispatchEvent(::nl::Weave::System::Layer & aLayer, void * aContext, ::nl::Weave::System::Event aEvent));
110+
friend ::nl::Weave::System::Error (::nl::Weave::System::Platform::Layer::StartTimer(::nl::Weave::System::Layer & aLayer, void * aContext, uint32_t aMilliseconds));
97111

98112
void PostEvent(const WeaveDeviceEvent * event);
99113
void DispatchEvent(const WeaveDeviceEvent * event);

0 commit comments

Comments
 (0)