This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for c/16302
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: "Thomas R. Truscott" <trt at cs dot duke dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 1 Jul 2004 14:55:00 +0000 (UTC)
- Subject: Re: Patch for c/16302
- References: <200407011448.i61EmLOi011526@eenie.cs.duke.edu>
On Thu, 1 Jul 2004, Thomas R. Truscott wrote:
> This patch adds a warning for some boolean-logic errors
> which are rare but easily overlooked (there are some in gcc itself).
> Bootstrapped on i686-pc-linux-gnu.
You need to include a testcase (so these warnings aren't accidentally
broken in future) and documentation (in this case, adding the warning to
the list of those in -Wextra). See <http://gcc.gnu.org/contribute.html>.
(-Wextra *is* a better place for this than warning unconditionally; some
such warnings for conditionals with fixed value are unconditional, but
this is broken since legitimate code can have such warnings on some
platforms only, depending on platform-specific types, without easily being
able to avoid them.)
> + if (or_op)
> + warning ("sas: `or' of collectively exhaustive tests is always 1");
> + else
> + warning ("sas: `and' of mutually exclusive tests is always 0");
The "sas: " doesn't make sense. The current style to follow for new
warnings doesn't use the ASCII grave accent as an opening quote; instead,
use %< as an opening quote and %> for a closing one, so:
warning ("%<or%> of collectively exhaustive tests is always 1");
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)