This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc-current: badly worded warning?
- From: Eyal Lebedinsky <eyal at eyal dot emu dot id dot au>
- To: list gcc <gcc at gcc dot gnu dot org>
- Date: Tue, 22 May 2007 23:36:30 +1000
- Subject: gcc-current: badly worded warning?
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