Patch for bug 21159

Joseph S. Myers joseph@codesourcery.com
Thu Apr 28 01:46:00 GMT 2005


On Wed, 27 Apr 2005, Daniel Jacobowitz wrote:

> On Thu, Apr 28, 2005 at 12:53:50AM +0000, Joseph S. Myers wrote:
> > +int f(void) { return (a ? (void)b : (void)c), d; } /* { dg-warning "warning: left-hand operand of comma expression has no effect" } */
> 
> Clever, clever.  But, should we be warning for that?  Does it add any
> value to do so?

Why would anyone legitimately write such code (even through a macro 
expansion) and expect to avoid a warning without an extra (void) cast?  
Does it add any value to remove the warning there?  (But the more 
significant bug my first patch introduced was that in the other warning 
test in this second testcase.)

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc-patches mailing list