Menu

#24 bad macro defn CHECK() in sapequal.c

open
nobody
None
5
2019-04-24
2019-04-23
Nick Briggs
No

Seems pretty dead around here... but just in case: Compiling OpenWRT, which included linux-atm-2.5.2, generated the following warning -- a result of missing parentheses in the macro definition for CHECK:

sapequal.c: In function 'match_blli':
sapequal.c:65:42: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
CHECK(l2.itu.window,a.l2.itu.window > b.l2.itu.window);
^
sapequal.c:46:10: note: in definition of macro 'CHECK'
if (!CONSTRAINT) return 0; \
^~~~~~~~~~
sapequal.c:46:9: note: add parentheses around left hand side expression to silence this warning
if (!CONSTRAINT) return 0; \
^~~~~~~~~~~~~~~~~~~~~~~~
if (res) res->FIELD = a.FIELD < b.FIELD ? a.FIELD : b.FIELD; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
~

Discussion

  • Nick Briggs

    Nick Briggs - 2019-04-23

    Obviously, the fix is
    if (!(CONSTRAINT)) return 0;

     
  • chas williams

    chas williams - 2019-04-24

    Some of us are still here. I will look into fixing this. Thanks for the bug report!

     

    Last edit: chas williams 2019-04-24

Log in to post a comment.