This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for bug 21159
On Thu, Apr 28, 2005 at 01:13:59AM +0000, Joseph S. Myers wrote:
> 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?
No, probably not. You can always cast the whole thing to void.
> (But the more
> significant bug my first patch introduced was that in the other warning
> test in this second testcase.)
Oh OK. I see how that case would fall through now. Boolean logic
makes my head hurt.
--
Daniel Jacobowitz
CodeSourcery, LLC