Zephyr: Support C++ builds

Some of the Zephyr include files need to be C++, not C based. The 'extern "C"'
wrapper in include/coap3/coap.h means that all #include are treated as being C.

Remove 'extern "C"' wrapper from include/coap3/coap.h and add wrapper to
include files after #include and before any function / structure definitions.

Add in a C++ build test for CI.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-08-21 12:17:41 +01:00
1 parent 7dff177f29
commit ea01661faf
68 files changed
+582 -29

No files matched your search

+8
View File
@@ -51,6 +51,10 @@
#include "oscore_cose.h"
#include "oscore_context.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup internal_api
* @addtogroup oscore_internal
@@ -124,4 +128,8 @@ void oscore_roll_back_seq(oscore_recipient_ctx_t *ctx);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _OSCORE_H */
+8
View File
@@ -49,6 +49,10 @@
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup internal_api
* @defgroup oscore_cbor_internal OSCORE CBOR Support
@@ -141,4 +145,8 @@ uint8_t oscore_cbor_strip_value(const uint8_t **data, size_t *buf_size,
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _OSCORE_CBOR_H */
+8
View File
@@ -52,6 +52,10 @@
#include "coap3/coap_uthash_internal.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup internal_api
* @addtogroup oscore_internal
@@ -278,4 +282,8 @@ int oscore_derive_keystream(oscore_ctx_t *osc_ctx,
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _OSCORE_CONTEXT_H */
+8
View File
@@ -48,6 +48,10 @@
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup internal_api
* @defgroup oscore_cose_internal OSCORE COSE Support
@@ -267,4 +271,8 @@ int cose_encrypt0_decrypt(cose_encrypt0_t *ptr,
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _OSCORE_COSE_H */
+8
View File
@@ -50,6 +50,10 @@
#include <coap3/coap_internal.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup internal_api
* @addtogroup oscore_internal
@@ -140,4 +144,8 @@ int oscore_hkdf(cose_hkdf_alg_t hkdf_alg,
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* _OSCORE_CRYPTO_H */