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

[Bug c/17896] The expression (a>0 & b>0) should give clearer warning message (-Wparentheses)


------- Additional Comments From trt at acm dot org  2004-10-08 20:00 -------
Created an attachment (id=7310)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7310&action=view)
proposed patch

I've attached a proposed patch for gcc to issue alternate warnings:
 
    suggest && instead of & when joining booleans
    suggest || instead of | when joining booleans
 
The patched gcc continues to warn (or not) as before, but with different text
when the operands are boolean-valued and without side effects.
I used COMPARISON_CLASS_P (t) as an approximation to "boolean-valued".
truth_value_p (TREE_CODE (t)) would be better but is unavailable.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17896


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