[PATCH 4/5] cpukit/include: Fixes for C++

chrisj at rtems.org chrisj at rtems.org
Fri Aug 19 07:16:21 UTC 2022


From: Chris Johns <chrisj at rtems.org>

Updates #4706
---
 cpukit/include/linux/rbtree.h             | 10 +++++++++-
 cpukit/include/rtems/capture.h            |  4 ++--
 cpukit/include/rtems/score/priority.h     |  4 ++--
 cpukit/include/rtems/score/priorityimpl.h |  2 +-
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/linux/rbtree.h b/cpukit/include/linux/rbtree.h
index b6ec864d06..fc6caad582 100644
--- a/cpukit/include/linux/rbtree.h
+++ b/cpukit/include/linux/rbtree.h
@@ -30,6 +30,10 @@
 
 #include <rtems/score/rbtree.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define rb_node RBTree_Node
 
 #define rb_left Node.rbe_left
@@ -109,7 +113,7 @@ static inline struct rb_node *rb_last( struct rb_root *root )
 
 static inline void rb_replace_node(
   struct rb_node *victim,
-  struct rb_node *replacement, 
+  struct rb_node *replacement,
   struct rb_root *root
 )
 {
@@ -151,4 +155,8 @@ static inline struct rb_node *rb_parent( struct rb_node *node )
     node = next \
   )
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _LINUX_RBTREE_H */
diff --git a/cpukit/include/rtems/capture.h b/cpukit/include/rtems/capture.h
index c37d652211..4ab638ec24 100644
--- a/cpukit/include/rtems/capture.h
+++ b/cpukit/include/rtems/capture.h
@@ -838,7 +838,7 @@ rtems_capture_task_flags (rtems_tcb* tcb)
 static inline rtems_capture_control*
 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
 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)
     return 0;
   return control->flags;
diff --git a/cpukit/include/rtems/score/priority.h b/cpukit/include/rtems/score/priority.h
index 6f6cc12bac..aa29fef8c0 100644
--- a/cpukit/include/rtems/score/priority.h
+++ b/cpukit/include/rtems/score/priority.h
@@ -45,12 +45,12 @@
 #include <rtems/score/cpu.h>
 #include <rtems/score/rbtree.h>
 
-struct _Scheduler_Control;
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct _Scheduler_Control;
+
 /**
  * @defgroup RTEMSScorePriority Priority Handler
  *
diff --git a/cpukit/include/rtems/score/priorityimpl.h b/cpukit/include/rtems/score/priorityimpl.h
index 55cddf53be..5a9a1673f6 100644
--- a/cpukit/include/rtems/score/priorityimpl.h
+++ b/cpukit/include/rtems/score/priorityimpl.h
@@ -403,7 +403,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Less(
   const Priority_Control *the_left;
   const Priority_Node    *the_right;
 
-  the_left = left;
+  the_left = (const Priority_Control*) left;
   the_right = RTEMS_CONTAINER_OF( right, Priority_Node, Node.RBTree );
 
   return *the_left < the_right->priority;
-- 
2.24.1



More information about the devel mailing list