gcc-current: badly worded warning?
Eyal Lebedinsky
eyal@eyal.emu.id.au
Tue May 22 16:14:00 GMT 2007
I see two kinds of warnings:
warning: logical '||' with non-zero constant will always evaluate as true
warning: logical '&&' with non-zero constant will always evaluate as true
The first statement is true, the second false. It can say (if the case is such)
warning: logical '&&' with zero constant will always evaluate as false
and even warn of
warning: logical '&&' with non-zero constant will have no effect
Actually, the statement leading to the '&&' warning has both logical operators.
Warning of the 'const ||' would actually be valid but none was issued.
#define SSA_ERRMSG_CHECK_BADRC 1 /* force error logging */
...
if (rc > 0 && (SSA_ERRMSG_CHECK_BADRC || (SSA_LOG_ERRORS & flags)))
and I would expect these two warnings for this statement:
warning: logical '||' with non-zero constant will always evaluate as true
warning: logical '&&' with non-zero constant will have no effect
--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>
attach .zip as .dat
More information about the Gcc
mailing list