This is the mail archive of the gcc-patches@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]

Re: Patch for c/16302


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)


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