cpukit/include: Fix including in C++

Closes #4709
This commit is contained in:
Chris Johns
2022-08-19 15:22:17 +10:00
parent b9de5b3bd6
commit c5b794227b
12 changed files with 47 additions and 20 deletions

View File

@@ -13,6 +13,10 @@
#include <stdint.h> #include <stdint.h>
#include <rtems/rtl/rtl-obj-fwd.h> #include <rtems/rtl/rtl-obj-fwd.h>
#ifdef __cplusplus
extern "C" {
#endif
enum sections enum sections
{ {
rap_text = 0, rap_text = 0,
@@ -76,4 +80,8 @@ int _rtld_linkmap_add (rtems_rtl_obj* obj);
* Remove link map from the list. * Remove link map from the list.
*/ */
void _rtld_linkmap_delete (rtems_rtl_obj* obj); void _rtld_linkmap_delete (rtems_rtl_obj* obj);
#ifdef __cplusplus
}
#endif
#endif /* _LINK_ELF_H_ */ #endif /* _LINK_ELF_H_ */

View File

@@ -17,6 +17,10 @@
#include <rtems/score/rbtree.h> #include <rtems/score/rbtree.h>
#ifdef __cplusplus
extern "C" {
#endif
#define rb_node RBTree_Node #define rb_node RBTree_Node
#define rb_left Node.rbe_left #define rb_left Node.rbe_left
@@ -138,4 +142,8 @@ static inline struct rb_node *rb_parent( struct rb_node *node )
node = next \ node = next \
) )
#ifdef __cplusplus
}
#endif
#endif /* _LINUX_RBTREE_H */ #endif /* _LINUX_RBTREE_H */

View File

@@ -838,7 +838,7 @@ rtems_capture_task_flags (rtems_tcb* tcb)
static inline rtems_capture_control* static inline rtems_capture_control*
rtems_capture_task_control (rtems_tcb* tcb) rtems_capture_task_control (rtems_tcb* tcb)
{ {
return tcb->Capture.control; return (rtems_capture_control*) tcb->Capture.control;
} }
/** /**
@@ -853,7 +853,7 @@ rtems_capture_task_control (rtems_tcb* tcb)
static inline uint32_t static inline uint32_t
rtems_capture_task_control_flags (rtems_tcb* tcb) rtems_capture_task_control_flags (rtems_tcb* tcb)
{ {
rtems_capture_control* control = tcb->Capture.control; rtems_capture_control* control = rtems_capture_task_control (tcb);
if (!control) if (!control)
return 0; return 0;
return control->flags; return control->flags;

View File

@@ -104,7 +104,7 @@ RTEMS_INLINE_ROUTINE POSIX_Mutex_Protocol _POSIX_Mutex_Get_protocol(
unsigned long flags 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( RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_recursive(
@@ -484,4 +484,3 @@ bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex );
#endif #endif
/* end of include file */ /* end of include file */

View File

@@ -72,7 +72,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Threads_Get_sched_param_sporadic(
#if defined(RTEMS_POSIX_API) #if defined(RTEMS_POSIX_API)
const POSIX_API_Control *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( param->sched_ss_low_priority = _POSIX_Priority_From_core(
scheduler, scheduler,
api->Sporadic.Low_priority.priority api->Sporadic.Low_priority.priority

View File

@@ -231,7 +231,7 @@ struct rtems_rtl_obj
size_t tramps_size; /**< Size of the trampoline memory. */ size_t tramps_size; /**< Size of the trampoline memory. */
void* tramp_brk; /**< Trampoline memory allocator. MD void* tramp_brk; /**< Trampoline memory allocator. MD
* relocators can take memory from the * relocators can take memory from the
* break upto the size. */ * break up to the size. */
size_t tramp_relocs; /**< Number of slots reserved for size_t tramp_relocs; /**< Number of slots reserved for
* relocs. The remainder are for * relocs. The remainder are for
* unresolved symbols. */ * unresolved symbols. */
@@ -333,7 +333,7 @@ static inline bool rtems_rtl_obj_text_inside (const rtems_rtl_obj* obj,
{ {
return return
(address >= obj->text_base) && (address >= obj->text_base) &&
(address < (obj->text_base + obj->text_size)); ((char*) address < ((char*) obj->text_base + obj->text_size));
} }
/** /**
@@ -367,6 +367,18 @@ static inline bool rtems_rtl_obj_has_symbol (const rtems_rtl_obj* obj,
sym < (obj->global_table + obj->global_syms)); 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. * Is there space in the trampoline memory for a trapoline.
* *
@@ -378,7 +390,7 @@ static inline bool rtems_rtl_obj_has_tramp_space (const rtems_rtl_obj* obj,
const size_t size) const size_t size)
{ {
return (obj->trampoline != NULL && return (obj->trampoline != NULL &&
((obj->tramp_brk - obj->trampoline) + size) <= obj->tramps_size); (rtems_rtl_obj_tramp_avail_space (obj) + size) <= obj->tramps_size);
} }
/** /**
@@ -402,7 +414,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) static inline size_t rtems_rtl_obj_trampolines (const rtems_rtl_obj* obj)
{ {
return obj->trampoline == NULL || obj->tramp_size == 0 ? 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;
} }
/** /**

View File

@@ -88,7 +88,7 @@ extern struct r_debug _rtld_debug;
* Debugger break function. Call when debugging to have it read the _rtld_debug * Debugger break function. Call when debugging to have it read the _rtld_debug
* variable. * variable.
*/ */
extern void _rtld_debug_state (void); void _rtld_debug_state (void);
/** /**
* The type of constructor/destructor function. * The type of constructor/destructor function.

View File

@@ -24,12 +24,12 @@
#include <rtems/score/cpu.h> #include <rtems/score/cpu.h>
#include <rtems/score/rbtree.h> #include <rtems/score/rbtree.h>
struct _Scheduler_Control;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
struct _Scheduler_Control;
/** /**
* @defgroup RTEMSScorePriority Priority Handler * @defgroup RTEMSScorePriority Priority Handler
* *

View File

@@ -389,7 +389,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Less(
const Priority_Control *the_left; const Priority_Control *the_left;
const Priority_Node *the_right; const Priority_Node *the_right;
the_left = left; the_left = (const Priority_Control*) left;
the_right = RTEMS_CONTAINER_OF( right, Priority_Node, Node.RBTree ); the_right = RTEMS_CONTAINER_OF( right, Priority_Node, Node.RBTree );
return *the_left < the_right->priority; return *the_left < the_right->priority;

View File

@@ -100,7 +100,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less(
Priority_Control prio_left; Priority_Control prio_left;
Priority_Control prio_right; Priority_Control prio_right;
the_left = left; the_left = (const Priority_Control*) left;
the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node ); the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node );
prio_left = *the_left; prio_left = *the_left;
@@ -128,7 +128,7 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Priority_less_equal(
Priority_Control prio_left; Priority_Control prio_left;
Priority_Control prio_right; Priority_Control prio_right;
the_left = left; the_left = (const Priority_Control*) left;
the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node ); the_right = RTEMS_CONTAINER_OF( right, Scheduler_EDF_Node, Node );
prio_left = *the_left; prio_left = *the_left;

View File

@@ -222,7 +222,7 @@ static inline void *_TLS_TCB_at_area_begin_initialize( void *tls_area )
{ {
void *tls_block = (char *) tls_area void *tls_block = (char *) tls_area
+ _TLS_Get_thread_control_block_area_size( (uintptr_t) _TLS_Alignment ); + _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_Heap_align_up( (uintptr_t) _TLS_Size ); uintptr_t aligned_size = _TLS_Heap_align_up( (uintptr_t) _TLS_Size );
TLS_Dynamic_thread_vector *dtv = (TLS_Dynamic_thread_vector *) TLS_Dynamic_thread_vector *dtv = (TLS_Dynamic_thread_vector *)
((char *) tls_block + aligned_size); ((char *) tls_block + aligned_size);

View File

@@ -150,7 +150,7 @@ RTEMS_INLINE_ROUTINE Watchdog_State _Watchdog_Get_state(
const Watchdog_Control *the_watchdog const Watchdog_Control *the_watchdog
) )
{ {
return RB_COLOR( &the_watchdog->Node.RBTree, Node ); return (Watchdog_State) RB_COLOR( &the_watchdog->Node.RBTree, Node );
} }
/** /**