From 9f8b765bbdbb8913fcadbde8d3362039e9dc8e61 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 9 Jan 2014 12:44:44 -0600 Subject: [PATCH] opr: Silence rbtree warning On OS X, gcc can complain that 'child' is uninitialized whenever this 'else if' condition is false. We already handled the case where both node->right and node->left are non-NULL earlier in this function, so this should never occur. So, to get rid of the warning, just always take the path in the 'else if', and assert that the right child is NULL. Change-Id: I3575de84ea172d3c7e0e022809fdcd0e3b4dcc27 Reviewed-on: http://gerrit.openafs.org/10687 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/opr/rbtree.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/opr/rbtree.c b/src/opr/rbtree.c index 8143e2d552..50e4115b7d 100644 --- a/src/opr/rbtree.c +++ b/src/opr/rbtree.c @@ -40,6 +40,7 @@ #else # include #endif +#include #include "rbtree.h" @@ -422,8 +423,10 @@ opr_rbtree_remove(struct opr_rbtree *head, struct opr_rbtree_node *node) if (node->left == NULL) child = node->right; - else if (node->right == NULL) + else { + opr_Assert(node->right == NULL); child = node->left; + } child->parent = node->parent;