This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]