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

git: top(1): Silence gcc warnings.


From: Stathis Kamperis <beket@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 4 Sep 2009 17:35:24 -0700 (PDT)

commit 6d76543904fe14ff9a80d02e173a623323774572
Author: Stathis Kamperis <beket@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



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