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]

tree.h RB_AUGMENT empty body warning

From: Dmitri Nikulin <dnikulin@xxxxxxxxx>
Date: Wed, 18 Feb 2009 22:49:29 +1100

Hi all,

I've been using tree.h (
http://www.dragonflybsd.org/cvsweb/src/sys/sys/tree.h ) in C projects
for a long time, and it has bothered me to have "suggest braces around
empty body in if-statement" warnings from GCC. Old GCCs didn't even
have a -Wno-empty-body flag, and I think the GCC in DragonFly itself
doesn't have the warning at all.

I took a look in the header itself and it looks like RB_AUGMENT is
defined as a macro expanding to nothing, and this causes the warnings
in any RB_GENERATE expansion. I don't know the history of tree.h so I
don't know why RB_AUGMENT is there at all, but the simplest solution
I've found is to redeclare it thus:

#define RB_AUGMENT(x) ((void)x)

This avoids the warning with no impact on the generated code. Whether
it's accepted by all desired standards and compilers is beyond my

Is there any reason to have that macro at all? It is defined only if
it's not already defined in a prior header, so maybe it's declared
differently in different parts of the kernel. If it must be kept, is
the re-definition I gave acceptable as a permanent commit? It will
certainly avoid a lot of warnings with GCC 4.2 and 4.3.

Thanks in advance!

Dmitri Nikulin

Centre for Synchrotron Science
Monash University
Victoria 3800, Australia

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