Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Telink] Enable -Wundef by default on Zephyr platform #29613

Merged
merged 24 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Telink] Fix builds
  • Loading branch information
s07641069 committed Oct 6, 2023
commit 841c8f2142ebbf9bf9d96fc3cd30bea43e97ef9f
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc
VerifyOrExit(otErr == OT_ERROR_NONE, err = MapOpenThreadError(otErr));

// Enable automatic assignment of Thread advertised addresses.
#if defined(OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE)
#if defined(OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE) && OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
otIp6SetSlaacEnabled(otInst, true);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/platform/Zephyr/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)

CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf)
{
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI)
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI) && CHIP_DEVICE_CONFIG_ENABLE_WIFI
const net_if * const iface = InetUtils::GetInterface();
VerifyOrReturnError(iface != nullptr && iface->if_dev != nullptr, CHIP_ERROR_INTERNAL);

Expand Down
2 changes: 1 addition & 1 deletion src/platform/Zephyr/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <malloc.h>

#if defined(CHIP_DEVICE_CONFIG_HEAP_STATISTICS_MALLINFO)
#if defined(CHIP_DEVICE_CONFIG_HEAP_STATISTICS_MALLINFO) && CHIP_DEVICE_CONFIG_HEAP_STATISTICS_MALLINFO

#ifdef CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE
const size_t kMaxHeapSize = CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE;
Expand Down
8 changes: 5 additions & 3 deletions src/platform/nrfconnect/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING
#endif

#if defined(CONFIG_NET_L2_OPENTHREAD) && CONFIG_NET_L2_OPENTHREAD
#define CHIP_DEVICE_CONFIG_ENABLE_THREAD CONFIG_NET_L2_OPENTHREAD
#endif

#ifdef CONFIG_WIFI_NRF700X
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CONFIG_WIFI_NRF700X
#endif

#ifdef CHIP_DEVICE_CONFIG_ENABLE_WIFI
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI) && CHIP_DEVICE_CONFIG_ENABLE_WIFI
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0
#else
Expand Down Expand Up @@ -219,7 +221,7 @@
#endif // CONFIG_CHIP_ENABLE_DNS_CLIENT
#endif // CONFIG_CHIP_ENABLE_DNSSD_SRP

#if defined(CONFIG_CHIP_ENABLE_ICD_SUPPORT) && defined(CONFIG_CHIP_THREAD_SSED)
#if defined(CONFIG_CHIP_ENABLE_ICD_SUPPORT) && CONFIG_CHIP_ENABLE_ICD_SUPPORT && defined(CONFIG_CHIP_THREAD_SSED) && CONFIG_CHIP_THREAD_SSED
#define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED
#endif // CONFIG_CHIP_ENABLE_ICD_SUPPORT

Expand Down Expand Up @@ -248,7 +250,7 @@
#endif // CONFIG_CHIP_EXTENDED_DISCOVERY

#ifndef CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH
#ifdef CONFIG_CHIP_FACTORY_DATA
#if defined(CONFIG_CHIP_FACTORY_DATA) && CONFIG_CHIP_FACTORY_DATA
// UID will be copied from the externally programmed factory data, so we don't know the actual length and we need to assume some max
// boundary.
#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH CONFIG_CHIP_FACTORY_DATA_ROTATING_DEVICE_UID_MAX_LEN
Expand Down
2 changes: 1 addition & 1 deletion src/platform/nrfconnect/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init()
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
GenericConnectivityManagerImpl_Thread<ConnectivityManagerImpl>::_Init();
#endif
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI)
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI) && CHIP_DEVICE_CONFIG_ENABLE_WIFI
ReturnErrorOnFailure(InitWiFi());
#endif
return CHIP_NO_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions src/platform/nrfconnect/ConnectivityManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <platform/internal/GenericConnectivityManagerImpl_NoThread.h>
#endif

#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI)
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI) && CHIP_DEVICE_CONFIG_ENABLE_WIFI
#include "wifi/ConnectivityManagerImplWiFi.h"
#else
#include <platform/internal/GenericConnectivityManagerImpl_NoWiFi.h>
Expand Down Expand Up @@ -71,7 +71,7 @@ class ConnectivityManagerImpl final : public ConnectivityManager,
#else
public Internal::GenericConnectivityManagerImpl_NoThread<ConnectivityManagerImpl>,
#endif
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI)
#if defined(CHIP_DEVICE_CONFIG_ENABLE_WIFI) && CHIP_DEVICE_CONFIG_ENABLE_WIFI
public ConnectivityManagerImplWiFi
#else
public Internal::GenericConnectivityManagerImpl_NoWiFi<ConnectivityManagerImpl>
Expand Down
6 changes: 3 additions & 3 deletions src/platform/nrfconnect/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <system/SystemError.h>

#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE)
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE) && CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#include <credentials/CertificationDeclaration.h>
#include <platform/Zephyr/ZephyrConfig.h>
#include <zephyr/settings/settings.h>
Expand All @@ -40,7 +40,7 @@

namespace chip {
namespace {
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE)
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE) && CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
// Cd globals are needed to be accessed from dfu image writer lambdas
uint8_t sCdBuf[chip::Credentials::kMaxCMSSignedCDMessage] = { 0 };
size_t sCdSavedBytes = 0;
Expand Down Expand Up @@ -89,7 +89,7 @@ CHIP_ERROR OTAImageProcessorImpl::PrepareDownloadImpl()
ReturnErrorOnFailure(System::MapErrorZephyr(dfu_multi_image_register_writer(&writer)));
};

#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE)
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE) && CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
dfu_image_writer cdWriter;
cdWriter.image_id = CONFIG_CHIP_CERTIFiCATION_DECLARATION_OTA_IMAGE_ID;
cdWriter.open = [](int id, size_t size) { return size <= sizeof(sCdBuf) ? 0 : -EFBIG; };
Expand Down
4 changes: 2 additions & 2 deletions src/platform/telink/FactoryDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "CHIPDevicePlatformConfig.h"
#include <crypto/CHIPCryptoPAL.h>

#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE) && CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#include <credentials/CertificationDeclaration.h>
#include <platform/Zephyr/ZephyrConfig.h>
#endif
Expand Down Expand Up @@ -101,7 +101,7 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::Init()
template <class FlashFactoryData>
CHIP_ERROR FactoryDataProvider<FlashFactoryData>::GetCertificationDeclaration(MutableByteSpan & outBuffer)
{
#if CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
#if defined(CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE) && CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE
ReturnErrorCodeIf(outBuffer.size() < mFactoryData.certificate_declaration.len, CHIP_ERROR_BUFFER_TOO_SMALL);
ReturnErrorCodeIf(!mFactoryData.certificate_declaration.data, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND);

Expand Down