From d8480f1859dae0f543ed802f6e8cc701f4b98dc6 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Tue, 12 Sep 2023 09:16:30 +0100 Subject: [PATCH] Convert if __ZEPHYR__ to if defined(__ZEPHYR__) (#29172) Fix building with `-Wundef` on non-Zephyr platforms. --- src/system/SystemConfig.h | 16 ++++++++-------- src/system/SystemError.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/system/SystemConfig.h b/src/system/SystemConfig.h index dceac0f8a49479..fba85f5caafc4f 100644 --- a/src/system/SystemConfig.h +++ b/src/system/SystemConfig.h @@ -121,7 +121,7 @@ #error "FORBIDDEN: CHIP_SYSTEM_CONFIG_MULTICAST_HOMING CAN ONLY BE USED WITH SOCKET IMPL" #endif -#if CHIP_SYSTEM_CONFIG_MULTICAST_HOMING && CHIP_SYSTEM_CONFIG_USE_SOCKETS && __ZEPHYR__ +#if CHIP_SYSTEM_CONFIG_MULTICAST_HOMING && CHIP_SYSTEM_CONFIG_USE_SOCKETS && defined(__ZEPHYR__) #error "FORBIDDEN: CHIP_SYSTEM_CONFIG_MULTICAST_HOMING WAS NOT TESTED WITH ZEPHYR" #endif @@ -639,7 +639,7 @@ struct LwIPEvent; * Defaults to enabled if the system is using sockets (except for Zephyr RTOS). */ #ifndef CHIP_SYSTEM_CONFIG_USE_POSIX_PIPE -#if (CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK) && !__ZEPHYR__ && !__MBED__ +#if (CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK) && !defined(__ZEPHYR__) && !defined(__MBED__) #define CHIP_SYSTEM_CONFIG_USE_POSIX_PIPE 1 #else #define CHIP_SYSTEM_CONFIG_USE_POSIX_PIPE 0 @@ -658,7 +658,7 @@ struct LwIPEvent; * Defaults to enabled on Zephyr platforms using sockets */ #ifndef CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && __ZEPHYR__ +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && defined(__ZEPHYR__) #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 1 #else #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0 @@ -679,7 +679,7 @@ struct LwIPEvent; * Defaults to enabled on Zephyr platforms using sockets */ #ifndef CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && __ZEPHYR__ +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && defined(__ZEPHYR__) #define CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API 1 #else #define CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API 0 @@ -695,7 +695,7 @@ struct LwIPEvent; * Defaults to enabled on Zephyr platforms using sockets */ #ifndef CHIP_SYSTEM_CONFIG_USE_ZEPHYR_NET_IF -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && __ZEPHYR__ +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && defined(__ZEPHYR__) #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_NET_IF 1 #else #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_NET_IF 0 @@ -711,7 +711,7 @@ struct LwIPEvent; * Defaults to enabled on Unix/Linux platforms using sockets */ #ifndef CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS -#if (CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK) && !__ZEPHYR__ +#if (CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK) && !defined(__ZEPHYR__) #define CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS 1 #else #define CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS 0 @@ -727,7 +727,7 @@ struct LwIPEvent; * Defaults to enabled on Zephyr platforms that do not enable Zephyr POSIX layer. */ #ifndef CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKETS -#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && __ZEPHYR__ && CONFIG_NET_SOCKETS_POSIX_NAMES +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS && defined(__ZEPHYR__) && CONFIG_NET_SOCKETS_POSIX_NAMES #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKETS 1 #else #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKETS 0 @@ -759,7 +759,7 @@ struct LwIPEvent; * Defaults to enabled on Zephyr platforms that enable CONFIG_EVENTFD. */ #ifndef CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD -#if __ZEPHYR__ && CONFIG_EVENTFD +#if defined(__ZEPHYR__) && CONFIG_EVENTFD #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 1 #else #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 0 diff --git a/src/system/SystemError.h b/src/system/SystemError.h index 37abd6c0b2257a..5bc4b79d1ebf1e 100644 --- a/src/system/SystemError.h +++ b/src/system/SystemError.h @@ -59,7 +59,7 @@ extern const char * DescribeErrorPOSIX(CHIP_ERROR code); extern void RegisterPOSIXErrorFormatter(); extern bool FormatPOSIXError(char * buf, uint16_t bufSize, CHIP_ERROR err); -#if __ZEPHYR__ +#ifdef __ZEPHYR__ extern CHIP_ERROR MapErrorZephyr(int code); #endif // __ZEPHYR__