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 bug 21159


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)


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