tree.h RB_AUGMENT empty body warning
Joerg Sonnenberger
joerg at britannica.bec.de
Wed Feb 18 15:45:58 PST 2009
On Wed, Feb 18, 2009 at 11:36:41AM -0800, Matthew Dillon wrote:
>
> :
> :On Wed, Feb 18, 2009 at 10:49:29PM +1100, Dmitri Nikulin wrote:
> :> #define RB_AUGMENT(x) ((void)x)
> :
> :Replace that with
> :#define RB_AUGMENT(x) do { (void)x; } while (0)
> :
> :Joerg
>
> I really don't like this idea. Adding braces and dummy do/while,
> but I don't like casting the passed expression to void simply as
> a means of avoiding a compiler warning.
The cast is needed as the value of the element should explicitly be
ignored for the default macro.
> What is this RB_AUGMENT stuff used for anyway? It looks to me like
> it should just be removed.
The older UVM map code in NetBSD at least used it to recompute the area
covered by a subtree as the tree is rebalanced. That is the only use
case I am aware of.
Joerg
More information about the Users
mailing list