git: top(1): Silence gcc warnings.

看板DFBSD_commit作者時間16年前 (2009/09/05 09:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
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
文章代碼(AID): #1AeRXJ2Z (DFBSD_commit)