top(1): Silence gcc warnings.
authorStathis Kamperis <beket@dragonflybsd.org>
Fri, 4 Sep 2009 17:22:49 +0000 (20:22 +0300)
committerStathis Kamperis <beket@dragonflybsd.org>
Sat, 5 Sep 2009 00:31:17 +0000 (03:31 +0300)
commit6d76543904fe14ff9a80d02e173a623323774572
tree4531579ec416c59b3d9c20b3d810d5731ae60c6f
parent86e91f6b37bf5a85d15098766d07550ca9fcb53b
top(1): Silence gcc warnings.

The ORDERKEY_XXX() macros build up a deeply nested set of if-statements.
E.g.,

if (expr)
   if (expr)
      if (expr)
        if (expr)

The last if-statement needs to contain nothing (every expression has
its own side effect, so the whole cascade is actually meaningful). Using
a ; though, makes gcc generate warnings regarding 'empty body in if
statements'. That's why we, instead, use:

ORDERKEY_FOO1
ORDERKEY_FOO2
...
ORDERKEY_FOO3
{}

We could have embedded the {} in the definition of the macro itself, but
that would break if someone rearranged the macros' call order.

Reviewed-by: dillon@
usr.bin/top/machine.c