This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new 7d862f635 kernel: Fix builds for C++
7d862f635 is described below
commit 7d862f635fb3b0c3326965ba3a02e486deeb433e
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sat Oct 19 20:59:03 2024 +0200
kernel: Fix builds for C++
Few headers did not have usual extern "C" blocks to be
safely included by C++ code.
In few cases extern "C" was place before includes that is not
correct way.
Signed-off-by: Jerzy Kasenberg <[email protected]>
---
kernel/os/include/os/arch/mips/os/os_arch.h | 8 ++++++++
kernel/os/include/os/arch/pic32/os/os_arch.h | 8 ++++++++
kernel/os/include/os/os_callout.h | 6 +++---
kernel/os/include/os/os_cputime.h | 8 ++++----
kernel/os/include/os/os_trace_api.h | 8 ++++++++
sys/console/full/include/console/history.h | 10 ++++++++++
sys/coredump/include/coredump/coredump.h | 4 ++--
sys/fault/include/fault/fault.h | 10 ++++++++++
sys/flash_map/include/flash_map/flash_map.h | 8 ++++----
sys/log/modlog/include/modlog/modlog.h | 8 ++++++++
sys/mfg/include/mfg/mfg.h | 10 ++++++++++
11 files changed, 75 insertions(+), 13 deletions(-)
diff --git a/kernel/os/include/os/arch/mips/os/os_arch.h
b/kernel/os/include/os/arch/mips/os/os_arch.h
index d03141907..4a3b51281 100644
--- a/kernel/os/include/os/arch/mips/os/os_arch.h
+++ b/kernel/os/include/os/arch/mips/os/os_arch.h
@@ -25,6 +25,10 @@
#include <mips/m32c0.h>
#include "mcu/mips.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* CPU status register */
typedef uint32_t os_sr_t;
@@ -53,6 +57,10 @@ os_arch_in_isr(void)
return (mips_getsr() & (1 << 1)) ? 1 : 0;
}
+#ifdef __cplusplus
+}
+#endif
+
/* Include common arch definitions and APIs */
#include "os/arch/common.h"
diff --git a/kernel/os/include/os/arch/pic32/os/os_arch.h
b/kernel/os/include/os/arch/pic32/os/os_arch.h
index 258494915..2197bf9dd 100644
--- a/kernel/os/include/os/arch/pic32/os/os_arch.h
+++ b/kernel/os/include/os/arch/pic32/os/os_arch.h
@@ -24,6 +24,10 @@
#include <xc.h>
#include "mcu/pic32.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* CPU status register */
typedef uint32_t os_sr_t;
@@ -50,6 +54,10 @@ os_arch_in_isr(void)
return (_CP0_GET_STATUS() & (_CP0_STATUS_EXL_MASK | _CP0_STATUS_IPL_MASK))
? 1 : 0;
}
+#ifdef __cplusplus
+}
+#endif
+
/* Include common arch definitions and APIs */
#include "os/arch/common.h"
diff --git a/kernel/os/include/os/os_callout.h
b/kernel/os/include/os/os_callout.h
index cd65a75ff..74ba7c7c1 100644
--- a/kernel/os/include/os/os_callout.h
+++ b/kernel/os/include/os/os_callout.h
@@ -27,13 +27,13 @@
*/
+#include "os/os_eventq.h"
+#include <stddef.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "os/os_eventq.h"
-#include <stddef.h>
-
/**
* Structure containing the definition of a callout, initialized
* by os_callout_init() and passed to callout functions.
diff --git a/kernel/os/include/os/os_cputime.h
b/kernel/os/include/os/os_cputime.h
index 947ef77aa..ad85f7e82 100644
--- a/kernel/os/include/os/os_cputime.h
+++ b/kernel/os/include/os/os_cputime.h
@@ -27,14 +27,14 @@
#ifndef H_OS_CPUTIME_
#define H_OS_CPUTIME_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include "syscfg/syscfg.h"
#include "os/queue.h"
#include "hal/hal_timer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* NOTE: these definitions allow one to override the cputime frequency used.
* The reason these definitions exist is to make the code more
diff --git a/kernel/os/include/os/os_trace_api.h
b/kernel/os/include/os/os_trace_api.h
index f6d0a5f44..e473b9642 100644
--- a/kernel/os/include/os/os_trace_api.h
+++ b/kernel/os/include/os/os_trace_api.h
@@ -36,6 +36,10 @@
#endif
#include "os/os.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define OS_TRACE_ID_EVENTQ_PUT (40)
#define OS_TRACE_ID_EVENTQ_GET_NO_WAIT (41)
#define OS_TRACE_ID_EVENTQ_GET (42)
@@ -318,6 +322,10 @@ os_trace_api_ret_u32(unsigned id, uint32_t return_value)
#endif /* !MYNEWT_VAL(OS_SYSVIEW) || defined(OS_TRACE_DISABLE_FILE_API) */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __ASSEMBLER__ */
#endif /* OS_TRACE_API_H */
diff --git a/sys/console/full/include/console/history.h
b/sys/console/full/include/console/history.h
index d5708038e..bb4f41578 100644
--- a/sys/console/full/include/console/history.h
+++ b/sys/console/full/include/console/history.h
@@ -19,6 +19,12 @@
#ifndef __SYS_CONSOLE_FULL_HISTORY_H__
#define __SYS_CONSOLE_FULL_HISTORY_H__
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* History search types for console_history_find()
*/
@@ -85,4 +91,8 @@ history_handle_t console_history_find(history_handle_t start,
int console_history_get(history_handle_t handle, size_t offset, char *buf,
size_t buf_size);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __SYS_CONSOLE_FULL_HISTORY_H__ */
diff --git a/sys/coredump/include/coredump/coredump.h
b/sys/coredump/include/coredump/coredump.h
index 53896681c..7a19a52eb 100644
--- a/sys/coredump/include/coredump/coredump.h
+++ b/sys/coredump/include/coredump/coredump.h
@@ -20,12 +20,12 @@
#ifndef __COREDUMP_H__
#define __COREDUMP_H__
+#include <inttypes.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <inttypes.h>
-
#define COREDUMP_MAGIC 0x690c47c3
/*
diff --git a/sys/fault/include/fault/fault.h b/sys/fault/include/fault/fault.h
index 8df8a2d4b..091c93f5c 100644
--- a/sys/fault/include/fault/fault.h
+++ b/sys/fault/include/fault/fault.h
@@ -65,8 +65,14 @@
* fatal failure always triggers a transition to the error state.
*/
+#include <stdbool.h>
+#include <stdint.h>
#include "debounce/debounce.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define FAULT_STATE_GOOD 0
#define FAULT_STATE_WARN 1
#define FAULT_STATE_ERROR 2
@@ -285,4 +291,8 @@ fault_register_domain(int domain_id, uint8_t success_delta,
name);
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sys/flash_map/include/flash_map/flash_map.h
b/sys/flash_map/include/flash_map/flash_map.h
index 131bc3028..b0e13efed 100644
--- a/sys/flash_map/include/flash_map/flash_map.h
+++ b/sys/flash_map/include/flash_map/flash_map.h
@@ -20,10 +20,6 @@
#ifndef H_UTIL_FLASH_MAP_
#define H_UTIL_FLASH_MAP_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/**
*
* Provides abstraction of flash regions for type of use.
@@ -46,6 +42,10 @@ extern "C" {
#include "syscfg/syscfg.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct flash_area {
uint8_t fa_id;
uint8_t fa_device_id;
diff --git a/sys/log/modlog/include/modlog/modlog.h
b/sys/log/modlog/include/modlog/modlog.h
index d4d132d9f..5a80b6a96 100644
--- a/sys/log/modlog/include/modlog/modlog.h
+++ b/sys/log/modlog/include/modlog/modlog.h
@@ -50,6 +50,10 @@
#include "os/mynewt.h"
#include "log/log.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MODLOG_MODULE_DFLT 255
/**
@@ -547,4 +551,8 @@ modlog_hexdump(uint8_t module, uint8_t level,
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/sys/mfg/include/mfg/mfg.h b/sys/mfg/include/mfg/mfg.h
index 5c8d36c9c..a756adab0 100644
--- a/sys/mfg/include/mfg/mfg.h
+++ b/sys/mfg/include/mfg/mfg.h
@@ -20,6 +20,12 @@
#ifndef H_MFG_
#define H_MFG_
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MFG_HASH_SZ 32
#define MFG_META_TLV_TYPE_HASH 0x01
@@ -146,4 +152,8 @@ int mfg_read_tlv_mmr_ref(const struct mfg_reader *reader,
*/
void mfg_init(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif