From 32b5fd77286a4ce825191bebc3cb999460031fa1 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 3 Jul 2020 17:58:33 +0200 Subject: [PATCH] Build errors with './bootstrap-configure --with-device-layer=linux' on macOS with clang --- src/include/platform/ConfigurationManager.h | 4 ++-- src/include/platform/PlatformManager.h | 8 ++++---- .../GenericConfigurationManagerImpl.ipp | 6 +++--- .../internal/GenericPlatformManagerImpl.ipp | 6 +++--- .../GenericPlatformManagerImpl_POSIX.ipp | 18 ++++++++++++------ src/platform/Linux/CHIPLinuxStorageIni.cpp | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index 315ad68609f882..4cdd8ded72ef63 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -138,8 +138,8 @@ class ConfigurationManager template 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; diff --git a/src/include/platform/PlatformManager.h b/src/include/platform/PlatformManager.h index f453e181d9d588..778006648307ab 100644 --- a/src/include/platform/PlatformManager.h +++ b/src/include/platform/PlatformManager.h @@ -116,13 +116,13 @@ class PlatformManager template 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); diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp index 53cbb3e1015f86..f2c14586c9131b 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -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; - template CHIP_ERROR GenericConfigurationManagerImpl::_Init() { @@ -1050,6 +1047,9 @@ void GenericConfigurationManagerImpl::LogDeviceConfig() #endif // CHIP_PROGRESS_LOGGING +// Fully instantiate the generic implementation class in whatever compilation unit includes this file. +template class GenericConfigurationManagerImpl; + } // namespace Internal } // namespace DeviceLayer } // namespace chip diff --git a/src/include/platform/internal/GenericPlatformManagerImpl.ipp b/src/include/platform/internal/GenericPlatformManagerImpl.ipp index 9a846393135176..29b027cd3bd1d5 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl.ipp +++ b/src/include/platform/internal/GenericPlatformManagerImpl.ipp @@ -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; - extern CHIP_ERROR InitEntropy(); template @@ -270,6 +267,9 @@ void GenericPlatformManagerImpl::HandleMessageLayerActivityChanged(bo } } +// Fully instantiate the generic implementation class in whatever compilation unit includes this file. +template class GenericPlatformManagerImpl; + } // namespace Internal } // namespace DeviceLayer } // namespace chip diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp index b6184172652a3f..d8b4c0f336650f 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp @@ -24,8 +24,8 @@ #ifndef GENERIC_PLATFORM_MANAGER_IMPL_POSIX_IPP #define GENERIC_PLATFORM_MANAGER_IMPL_POSIX_IPP -#include #include +#include #include // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, @@ -34,13 +34,13 @@ #include -#include #include #include #include +#include #include -#include #include +#include #define DEFAULT_MIN_SLEEP_PERIOD (60 * 60 * 24 * 30) // Month [sec] @@ -48,15 +48,18 @@ namespace chip { namespace DeviceLayer { namespace Internal { -// Fully instantiate the generic implementation class in whatever compilation unit includes this file. -template class GenericPlatformManagerImpl_POSIX; - template CHIP_ERROR GenericPlatformManagerImpl_POSIX::_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(); @@ -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; + } // namespace Internal } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Linux/CHIPLinuxStorageIni.cpp b/src/platform/Linux/CHIPLinuxStorageIni.cpp index 534c9dbcc0a4ea..01f56d7aa71c9c 100644 --- a/src/platform/Linux/CHIPLinuxStorageIni.cpp +++ b/src/platform/Linux/CHIPLinuxStorageIni.cpp @@ -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; }