On Tue, Apr 27, 2021 at 10:32:45AM -0500, Bill Schmidt via Gcc-patches wrote:
> 2021-03-03  Bill Schmidt  <wschm...@linux.ibm.com>
> 
> gcc/
>       * config/rs6000/rbtree.c: New file.
>       * config/rs6000/rbtree.h: New file.

> +  struct rbt_string_node *nodeptr
> +    = (struct rbt_string_node *) malloc (sizeof (struct rbt_string_node));

malloc (sizeof *nodeptr)  helps catch foolish errors.  This is one of
the secondary reasons not too use superfluous parens with the sizeof
operator: when you see them you know there is probably something not
quite right (like here, should not repeat the type, it is too easy to
make errors that way).

> +     /* Gender-neutral formations are awkward, so let's be fair. ;-)
> +        ("Parent-sibling" is just awful.)  */
> +     struct rbt_string_node *aunt = curr->par->par->left;

"unt" is nice imo :-)

> --- /dev/null
> +++ b/gcc/config/rs6000/rbtree.h

> +/* Red-black binary search tree on strings.  Presently we don't support
> +   deletes; only insert/find operations are implemented.  */
> +enum rbt_color
> +  {
> +    RBT_BLACK,
> +    RBT_RED
> +  };

You you need this in the header?  You could just say
  enum rbt_color;
and nothing more?

Okay for trunk, whatever you decide to do for these.  Thanks!


Segher

Reply via email to