Skip to content

Commit

Permalink
Convert if __ZEPHYR__ to if defined(__ZEPHYR__) (project-chip#29172)
Browse files Browse the repository at this point in the history
Fix building with `-Wundef` on non-Zephyr platforms.
  • Loading branch information
rojer authored Sep 12, 2023
1 parent 0547832 commit d8480f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/system/SystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/system/SystemError.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down

0 comments on commit d8480f1

Please sign in to comment.