git: top(1): Silence gcc warnings.

Stathis Kamperis beket at crater.dragonflybsd.org
Fri Sep 4 17:36:17 PDT 2009


commit 6d76543904fe14ff9a80d02e173a623323774572
Author: Stathis Kamperis <beket at dragonflybsd.org>
Date:   Fri Sep 4 20:22:49 2009 +0300

    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@

Summary of changes:
 usr.bin/top/machine.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6d76543904fe14ff9a80d02e173a623323774572


-- 
DragonFly BSD source repository





More information about the Commits mailing list