[rtems commit] score/rbtree: C++ compatibility

Ralf Corsepius ralf.corsepius at rtems.org
Fri Mar 30 09:47:13 UTC 2012


On 03/30/2012 11:39 AM, Sebastian Huber wrote:
> Module:    rtems
> Branch:    master
> Commit:    c6dbcd6910a13443f1daed2300afe07afee7ed26
> Changeset: http://git.rtems.org/rtems/commit/?id=c6dbcd6910a13443f1daed2300afe07afee7ed26
>
> Author:    Sebastian Huber<sebastian.huber at embedded-brains.de>
> Date:      Fri Mar 30 11:21:32 2012 +0200
>
> score/rbtree: C++ compatibility
>
> ---
>
>   cpukit/score/inline/rtems/score/rbtree.inl |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/cpukit/score/inline/rtems/score/rbtree.inl b/cpukit/score/inline/rtems/score/rbtree.inl
> index c74726a..422924a 100644
> --- a/cpukit/score/inline/rtems/score/rbtree.inl
> +++ b/cpukit/score/inline/rtems/score/rbtree.inl
> @@ -38,7 +38,7 @@ RTEMS_INLINE_ROUTINE RBTree_Direction _RBTree_Opposite_direction(
>     RBTree_Direction the_dir
>   )
>   {
> -  return (!the_dir);
> +  return (RBTree_Direction) !((int) the_dir);
>   }
>
>   /** @brief Set off rbtree
> @@ -368,7 +368,8 @@ RTEMS_INLINE_ROUTINE RBTree_Node *_RBTree_Find_unprotected(
>           break;
>       }
>
> -    RBTree_Direction dir = _RBTree_Is_greater( compare_result );
> +    RBTree_Direction dir =
> +      (RBTree_Direction) _RBTree_Is_greater( compare_result );
>       iter_node = iter_node->child[dir];
>     } /* while(iter_node) */
>

This patch does not seem right to me.

Without having checked details, my gut feeling is you might be spraying 
casts to work around an improperly declared or improperly used function.


Ralf




More information about the devel mailing list