[PATCH 5/5] cpukit/include: Fix including in C++
chrisj at rtems.org
chrisj at rtems.org
Fri Aug 19 07:16:22 UTC 2022
From: Chris Johns <chrisj at rtems.org>
UPdates #4706
---
cpukit/include/link_elf.h | 8 ++++++++
cpukit/include/rtems/posix/muteximpl.h | 7 +++----
cpukit/include/rtems/posix/pthreadattrimpl.h | 2 +-
cpukit/include/rtems/rtl/rtl-obj.h | 20 +++++++++++++++----
cpukit/include/rtems/rtl/rtl.h | 2 +-
cpukit/include/rtems/score/scheduleredfimpl.h | 4 ++--
cpukit/include/rtems/score/tls.h | 2 +-
7 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/cpukit/include/link_elf.h b/cpukit/include/link_elf.h
index 6cab3c2c7f..6483c021fd 100644
--- a/cpukit/include/link_elf.h
+++ b/cpukit/include/link_elf.h
@@ -13,6 +13,10 @@
#include <stdint.h>
#include <rtems/rtl/rtl-obj-fwd.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum sections
{
rap_text = 0,
@@ -76,4 +80,8 @@ int _rtld_linkmap_add (rtems_rtl_obj* obj);
* Remove link map from the list.
*/
void _rtld_linkmap_delete (rtems_rtl_obj* obj);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _LINK_ELF_H_ */
diff --git a/cpukit/include/rtems/posix/muteximpl.h b/cpukit/include/rtems/posix/muteximpl.h
index e2b4e187d1..ff1b7b1643 100644
--- a/cpukit/include/rtems/posix/muteximpl.h
+++ b/cpukit/include/rtems/posix/muteximpl.h
@@ -4,8 +4,8 @@
* @file
*
* @brief Private Inlined Routines for POSIX Mutex's.
- *
- * This include file contains the static inline implementation of the private
+ *
+ * This include file contains the static inline implementation of the private
* inlined routines for POSIX mutex's.
*/
@@ -123,7 +123,7 @@ RTEMS_INLINE_ROUTINE POSIX_Mutex_Protocol _POSIX_Mutex_Get_protocol(
unsigned long flags
)
{
- return flags & POSIX_MUTEX_PROTOCOL_MASK;
+ return (POSIX_Mutex_Protocol) (flags & POSIX_MUTEX_PROTOCOL_MASK);
}
RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_recursive(
@@ -465,4 +465,3 @@ bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex );
#endif
/* end of include file */
-
diff --git a/cpukit/include/rtems/posix/pthreadattrimpl.h b/cpukit/include/rtems/posix/pthreadattrimpl.h
index b94c6fc193..e1211c2861 100644
--- a/cpukit/include/rtems/posix/pthreadattrimpl.h
+++ b/cpukit/include/rtems/posix/pthreadattrimpl.h
@@ -91,7 +91,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Threads_Get_sched_param_sporadic(
#if defined(RTEMS_POSIX_API)
const POSIX_API_Control *api;
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ api = (const POSIX_API_Control*) the_thread->API_Extensions[ THREAD_API_POSIX ];
param->sched_ss_low_priority = _POSIX_Priority_From_core(
scheduler,
api->Sporadic.Low_priority.priority
diff --git a/cpukit/include/rtems/rtl/rtl-obj.h b/cpukit/include/rtems/rtl/rtl-obj.h
index 33951e10d1..6b47eb1205 100644
--- a/cpukit/include/rtems/rtl/rtl-obj.h
+++ b/cpukit/include/rtems/rtl/rtl-obj.h
@@ -250,7 +250,7 @@ struct rtems_rtl_obj
size_t tramps_size; /**< Size of the trampoline memory. */
void* tramp_brk; /**< Trampoline memory allocator. MD
* relocators can take memory from the
- * break upto the size. */
+ * break up to the size. */
size_t tramp_relocs; /**< Number of slots reserved for
* relocs. The remainder are for
* unresolved symbols. */
@@ -352,7 +352,7 @@ static inline bool rtems_rtl_obj_text_inside (const rtems_rtl_obj* obj,
{
return
(address >= obj->text_base) &&
- (address < (obj->text_base + obj->text_size));
+ ((char*) address < ((char*) obj->text_base + obj->text_size));
}
/**
@@ -386,6 +386,18 @@ static inline bool rtems_rtl_obj_has_symbol (const rtems_rtl_obj* obj,
sym < (obj->global_table + obj->global_syms));
}
+/**
+ * Is there space in the trampoline memory for a trapoline.
+ *
+ * @param obj The object file's descriptor to check for available space.
+ * @param size The size to be allocated.
+ * @retval bool Returns @true if the space is available.
+ */
+static inline size_t rtems_rtl_obj_tramp_avail_space (const rtems_rtl_obj* obj)
+{
+ return (char*) obj->tramp_brk - (char*) obj->trampoline;
+}
+
/**
* Is there space in the trampoline memory for a trapoline.
*
@@ -397,7 +409,7 @@ static inline bool rtems_rtl_obj_has_tramp_space (const rtems_rtl_obj* obj,
const size_t size)
{
return (obj->trampoline != NULL &&
- ((obj->tramp_brk - obj->trampoline) + size) <= obj->tramps_size);
+ (rtems_rtl_obj_tramp_avail_space (obj) + size) <= obj->tramps_size);
}
/**
@@ -421,7 +433,7 @@ static inline size_t rtems_rtl_obj_trampoline_slots (const rtems_rtl_obj* obj)
static inline size_t rtems_rtl_obj_trampolines (const rtems_rtl_obj* obj)
{
return obj->trampoline == NULL || obj->tramp_size == 0 ?
- 0 : (obj->tramp_brk - obj->trampoline) / obj->tramp_size;
+ 0 : rtems_rtl_obj_tramp_avail_space (obj) / obj->tramp_size;
}
/**
diff --git a/cpukit/include/rtems/rtl/rtl.h b/cpukit/include/rtems/rtl/rtl.h
index 7901127785..0fd4e74cdf 100644
--- a/cpukit/include/rtems/rtl/rtl.h
+++ b/cpukit/include/rtems/rtl/rtl.h
@@ -107,7 +107,7 @@ extern struct r_debug _rtld_debug;
* Debugger break function. Call when debugging to have it read the _rtld_debug
* variable.
*/
-extern void _rtld_debug_state (void);
+void _rtld_debug_state (void);
/**
* The type of constructor/destructor function.
diff --git a/cpukit/include/rtems/score/scheduleredfimpl.h b/cpukit/include/rtems/score/scheduleredfimpl.h
index 06a35ae95f..3e180c0526 100644
--- a/cpukit/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/include/rtems/score/scheduleredfimpl.h
@@ -120,7 +120,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less(
Priority_Control prio_left;
Priority_Control prio_right;
- the_left = left;
+ the_left = (const Priority_Control*) left;
the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node );
prio_left = *the_left;
@@ -148,7 +148,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Priority_less_equal(
Priority_Control prio_left;
Priority_Control prio_right;
- the_left = left;
+ the_left = (const Priority_Control*) left;
the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node );
prio_left = *the_left;
diff --git a/cpukit/include/rtems/score/tls.h b/cpukit/include/rtems/score/tls.h
index f3bcb2c96a..3881af2b11 100644
--- a/cpukit/include/rtems/score/tls.h
+++ b/cpukit/include/rtems/score/tls.h
@@ -241,7 +241,7 @@ static inline void *_TLS_TCB_at_area_begin_initialize( void *tls_area )
{
void *tls_block = (char *) tls_area
+ _TLS_Get_thread_control_block_area_size( (uintptr_t) _TLS_Alignment );
- TLS_Thread_control_block *tcb = tls_area;
+ TLS_Thread_control_block *tcb = (TLS_Thread_control_block*) tls_area;
uintptr_t aligned_size = _TLS_Align_up( (uintptr_t) _TLS_Size );
TLS_Dynamic_thread_vector *dtv = (TLS_Dynamic_thread_vector *)
((char *) tls_block + aligned_size);
--
2.24.1
More information about the devel
mailing list