Skip to content

Commit

Permalink
Build errors with './bootstrap-configure --with-device-layer=linux' o…
Browse files Browse the repository at this point in the history
…n macOS with clang
  • Loading branch information
vivien-apple committed Jul 7, 2020
1 parent 06747fd commit 32b5fd7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/include/platform/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ class ConfigurationManager
template <class>
friend class ::chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX;
// Parentheses used to fix clang parsing issue with these declarations
friend CHIP_ERROR ::chip::Platform::PersistedStorage::Read(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
friend CHIP_ERROR ::chip::Platform::PersistedStorage::Write(::chip::Platform::PersistedStorage::Key key, uint32_t value);
friend CHIP_ERROR(::chip::Platform::PersistedStorage::Read)(::chip::Platform::PersistedStorage::Key key, uint32_t & value);
friend CHIP_ERROR(::chip::Platform::PersistedStorage::Write)(::chip::Platform::PersistedStorage::Key key, uint32_t value);

using ImplClass = ::chip::DeviceLayer::ConfigurationManagerImpl;

Expand Down
8 changes: 4 additions & 4 deletions src/include/platform/PlatformManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ class PlatformManager
template <class>
friend class Internal::GenericConfigurationManagerImpl;
// Parentheses used to fix clang parsing issue with these declarations
friend ::chip::System::Error ::chip::System::Platform::Layer::PostEvent(::chip::System::Layer & aLayer, void * aContext,
friend ::chip::System::Error(::chip::System::Platform::Layer::PostEvent)(::chip::System::Layer & aLayer, void * aContext,
::chip::System::Object & aTarget,
::chip::System::EventType aType, uintptr_t aArgument);
friend ::chip::System::Error ::chip::System::Platform::Layer::DispatchEvents(::chip::System::Layer & aLayer, void * aContext);
friend ::chip::System::Error ::chip::System::Platform::Layer::DispatchEvent(::chip::System::Layer & aLayer, void * aContext,
friend ::chip::System::Error(::chip::System::Platform::Layer::DispatchEvents)(::chip::System::Layer & aLayer, void * aContext);
friend ::chip::System::Error(::chip::System::Platform::Layer::DispatchEvent)(::chip::System::Layer & aLayer, void * aContext,
::chip::System::Event aEvent);
friend ::chip::System::Error ::chip::System::Platform::Layer::StartTimer(::chip::System::Layer & aLayer, void * aContext,
friend ::chip::System::Error(::chip::System::Platform::Layer::StartTimer)(::chip::System::Layer & aLayer, void * aContext,
uint32_t aMilliseconds);

void PostEvent(const ChipDeviceEvent * event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericConfigurationManagerImpl<ConfigurationManagerImpl>;

template <class ImplClass>
CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_Init()
{
Expand Down Expand Up @@ -1050,6 +1047,9 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

#endif // CHIP_PROGRESS_LOGGING

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericConfigurationManagerImpl<ConfigurationManagerImpl>;

} // namespace Internal
} // namespace DeviceLayer
} // namespace chip
Expand Down
6 changes: 3 additions & 3 deletions src/include/platform/internal/GenericPlatformManagerImpl.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericPlatformManagerImpl<PlatformManagerImpl>;

extern CHIP_ERROR InitEntropy();

template <class ImplClass>
Expand Down Expand Up @@ -270,6 +267,9 @@ void GenericPlatformManagerImpl<ImplClass>::HandleMessageLayerActivityChanged(bo
}
}

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericPlatformManagerImpl<PlatformManagerImpl>;

} // namespace Internal
} // namespace DeviceLayer
} // namespace chip
Expand Down
18 changes: 12 additions & 6 deletions src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#ifndef GENERIC_PLATFORM_MANAGER_IMPL_POSIX_IPP
#define GENERIC_PLATFORM_MANAGER_IMPL_POSIX_IPP

#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <platform/PlatformManager.h>
#include <platform/internal/CHIPDeviceLayerInternal.h>
#include <platform/internal/GenericPlatformManagerImpl_POSIX.h>

// Include the non-inline definitions for the GenericPlatformManagerImpl<> template,
Expand All @@ -34,29 +34,32 @@

#include <system/SystemLayer.h>

#include <poll.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <sched.h>
#include <unistd.h>
#include <sys/select.h>
#include <unistd.h>

#define DEFAULT_MIN_SLEEP_PERIOD (60 * 60 * 24 * 30) // Month [sec]

namespace chip {
namespace DeviceLayer {
namespace Internal {

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>;

template <class ImplClass>
CHIP_ERROR GenericPlatformManagerImpl_POSIX<ImplClass>::_InitChipStack(void)
{
CHIP_ERROR err = CHIP_NO_ERROR;

#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
mChipStackLock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
mChipStackLock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
#else
#error "No defined static initializer for POSIX Threads recursive mutex!"
#endif // defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)

// Initialize the Configuration Manager object.
err = ConfigurationMgr().Init();
Expand Down Expand Up @@ -217,6 +220,9 @@ exit:
return System::MapErrorPOSIX(err);
}

// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
template class GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>;

} // namespace Internal
} // namespace DeviceLayer
} // namespace chip
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/CHIPLinuxStorageIni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CHIP_ERROR ChipLinuxStorageIni::AddConfig(const std::string & configFile)
}
else
{
ChipLogError(DeviceLayer, "Failed to open config file: %s", configFile);
ChipLogError(DeviceLayer, "Failed to open config file: %s", configFile.c_str());
retval = CHIP_ERROR_PERSISTED_STORAGE_FAIL;
}

Expand Down

0 comments on commit 32b5fd7

Please sign in to comment.