Skip to content

Commit 393dab2

Browse files
Merge pull request #9524 from julek-wolfssl/zephyr-cpp
Updates for latest zephyr with cpp
2 parents b42e9a9 + ac84464 commit 393dab2

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

wolfssl/wolfcrypt/settings.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,6 @@ extern void uITRON4_free(void *p) ;
26052605
#include <stdlib.h>
26062606

26072607
#define WOLFSSL_DH_CONST
2608-
#define WOLFSSL_HAVE_MAX
26092608
#define NO_WRITEV
26102609
#define NO_STDLIB_ISASCII
26112610

@@ -2616,7 +2615,6 @@ extern void uITRON4_free(void *p) ;
26162615

26172616
void *z_realloc(void *ptr, size_t size);
26182617
#define realloc z_realloc
2619-
#define max MAX
26202618

26212619
#if !defined(CONFIG_NET_SOCKETS_POSIX_NAMES) && !defined(CONFIG_POSIX_API)
26222620
#define CONFIG_NET_SOCKETS_POSIX_NAMES

wolfssl/wolfcrypt/wc_port.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,24 +283,30 @@
283283
#elif defined(WOLFSSL_APACHE_MYNEWT)
284284
/* do nothing */
285285
#elif defined(WOLFSSL_ZEPHYR)
286+
/* Zephyr SDK can use a cpp compiler which will cause
287+
* problems with extern "C" linkage if not handled */
288+
#ifdef __cplusplus
289+
} /* extern "C" */
290+
#endif
291+
286292
#include <version.h>
287293
#ifndef SINGLE_THREADED
288294
#if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS)
289295
#error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS"
290296
#endif
291-
#ifdef max
292-
#undef max
293-
#endif
294-
#if KERNEL_VERSION_NUMBER >= 0x30100
295-
#include <zephyr/kernel.h>
296-
#include <zephyr/posix/posix_types.h>
297-
#include <zephyr/posix/pthread.h>
298-
#else
299-
#include <kernel.h>
300-
#include <posix/posix_types.h>
301-
#include <posix/pthread.h>
297+
#if KERNEL_VERSION_NUMBER >= 0x30100
298+
#include <zephyr/kernel.h>
299+
#include <zephyr/posix/posix_types.h>
300+
#include <zephyr/posix/pthread.h>
301+
#else
302+
#include <kernel.h>
303+
#include <posix/posix_types.h>
304+
#include <posix/pthread.h>
305+
#endif
302306
#endif
303-
#define max MAX
307+
308+
#ifdef __cplusplus
309+
extern "C" {
304310
#endif
305311
#elif defined(WOLFSSL_TELIT_M2MB)
306312

0 commit comments

Comments
 (0)