Skip to content

Commit 9c4ce02

Browse files
committed
Use __has_include(<zephyr/version.h>) with a fallback to <version.h>
1 parent e31fb09 commit 9c4ce02

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

wolfcrypt/src/random.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3447,7 +3447,15 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
34473447

34483448
#elif defined(WOLFSSL_ZEPHYR)
34493449

3450-
#include <version.h>
3450+
#ifdef __has_include
3451+
#if __has_include(<zephyr/version.h>)
3452+
#include <zephyr/version.h>
3453+
#else
3454+
#include <version.h>
3455+
#endif
3456+
#else
3457+
#include <version.h>
3458+
#endif
34513459

34523460
#if KERNEL_VERSION_NUMBER >= 0x30500
34533461
#include <zephyr/random/random.h>

wolfssl/test.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,15 @@
188188
#include <pthread.h>
189189
#define SOCKET_T int
190190
#elif defined(WOLFSSL_ZEPHYR)
191-
#include <version.h>
191+
#ifdef __has_include
192+
#if __has_include(<zephyr/version.h>)
193+
#include <zephyr/version.h>
194+
#else
195+
#include <version.h>
196+
#endif
197+
#else
198+
#include <version.h>
199+
#endif
192200
#include <string.h>
193201
#include <sys/types.h>
194202
#if KERNEL_VERSION_NUMBER >= 0x30100

wolfssl/wolfcrypt/settings.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,15 @@ extern void uITRON4_free(void *p) ;
26142614
} /* extern "C" */
26152615
#endif
26162616

2617-
#include <version.h>
2617+
#ifdef __has_include
2618+
#if __has_include(<zephyr/version.h>)
2619+
#include <zephyr/version.h>
2620+
#else
2621+
#include <version.h>
2622+
#endif
2623+
#else
2624+
#include <version.h>
2625+
#endif
26182626
#if KERNEL_VERSION_NUMBER >= 0x30100
26192627
#include <zephyr/kernel.h>
26202628
#include <zephyr/sys/printk.h>

wolfssl/wolfcrypt/wc_port.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,15 @@
287287
} /* extern "C" */
288288
#endif
289289

290-
#include <version.h>
290+
#ifdef __has_include
291+
#if __has_include(<zephyr/version.h>)
292+
#include <zephyr/version.h>
293+
#else
294+
#include <version.h>
295+
#endif
296+
#else
297+
#include <version.h>
298+
#endif
291299
#ifndef SINGLE_THREADED
292300
#if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS)
293301
#error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS"
@@ -1495,7 +1503,15 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
14951503
} /* extern "C" */
14961504
#endif
14971505

1498-
#include <version.h>
1506+
#ifdef __has_include
1507+
#if __has_include(<zephyr/version.h>)
1508+
#include <zephyr/version.h>
1509+
#else
1510+
#include <version.h>
1511+
#endif
1512+
#else
1513+
#include <version.h>
1514+
#endif
14991515
#ifndef _POSIX_C_SOURCE
15001516
#if KERNEL_VERSION_NUMBER >= 0x30100
15011517
#include <zephyr/posix/time.h>

wolfssl/wolfio.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,15 @@
180180
} /* extern "C" */
181181
#endif
182182

183-
#include <version.h>
183+
#ifdef __has_include
184+
#if __has_include(<zephyr/version.h>)
185+
#include <zephyr/version.h>
186+
#else
187+
#include <version.h>
188+
#endif
189+
#else
190+
#include <version.h>
191+
#endif
184192
#if KERNEL_VERSION_NUMBER >= 0x30100
185193
#include <zephyr/net/socket.h>
186194
#ifdef CONFIG_POSIX_API

0 commit comments

Comments
 (0)