DragonFly users List (threaded) for 2009-02
DragonFly BSD
DragonFly users List (threaded) for 2009-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: tree.h RB_AUGMENT empty body warning


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Thu, 19 Feb 2009 00:36:29 +0100
Mail-followup-to: users@crater.dragonflybsd.org

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



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]