coleman@twinsun.com (Mike Coleman) (01/20/90)
calls to the GNU assert macro cause the error message file.c:2059: warning: ANSI C forbids conditional expr with only one void side when compiled with -ansi -pedantic. This can be prevented by changing #define assert(expression) \ ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)) to #define assert(expression) \ ((expression) ? (void) 0 : __assert (#expression, __FILE__, __LINE__)) in assert.h. The only penalty I can see is the miniscule cost of compiling the extra cast. Mike Coleman coleman@twinsun.com
rfg@ics.uci.edu (Ron Guilmette) (01/21/90)
In article <9001200425.AA02377@spot.twinsun.com> coleman@twinsun.com (Mike Coleman) writes: >calls to the GNU assert macro cause the error message > >file.c:2059: warning: ANSI C forbids conditional expr with only one void side > >when compiled with -ansi -pedantic. This can be prevented by changing > >#define assert(expression) \ > ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)) > >to > >#define assert(expression) \ > ((expression) ? (void) 0 : __assert (#expression, __FILE__, __LINE__)) > >in assert.h. The only penalty I can see is the miniscule cost of compiling >the extra cast. As long as we're at it, could we perhaps also have an extern declaration for __assert() so that we can avoid warnings when using -Wimplicit? // rfg