Re: [PATCH] fix some clang warnings
- From
John Keeping <john@keeping.me.uk>
- Date
- Jan 16, 2013, 18:22 UTC
- Message-ID
- <20130116182240.GC2476@farnsworth.metanate.com>
- In-Reply-To
- <20130116181558.GA4426@sigill.intra.peff.net>
On Wed, Jan 16, 2013 at 10:15:58AM -0800, Jeff King wrote:
Show 32 quoted lines
> On Wed, Jan 16, 2013 at 06:12:03PM +0000, John Keeping wrote:
>
> > On Wed, Jan 16, 2013 at 10:00:42AM -0800, Jeff King wrote:
> > > It is not about the macro itself, but rather the callsites that do not
> > > return error, but call it for its printing side effect. It seems that
> > > clang -Wunused-value is OK with unused values from functions being
> > > discarded, but not with constants. So:
> > >
> > > int foo();
> > > void bar()
> > > {
> > > foo(); /* ok */
> > > 1; /* not ok */
> > > (foo(), 1); /* not ok */
> > > }
> > >
> > > The first one is OK (I think it would fall under -Wunused-result under
> > > either compiler). The middle one is an obvious error, and caught by both
> > > compilers. The last one is OK by gcc, but clang complains.
> >
> > I wonder if this would be changed in clang - the change in [1] is
> > superficially similar.
> >
> > [1] http://llvm.org/bugs/show_bug.cgi?id=13747
>
> Yeah, I think it is exactly the same issue, and the fix they mention
> there would apply to us, too.
>
> Is it worth applying this at all, then? Or should we apply it but limit
> it with a clang version macro (they mention r163034, but I do not know
> if it is in a released version yet, nor what macros are available to
> inspect the version)?That maps to revision 06b3a06007 in their git repository [1], which is contained in remotes/origin/release_32 so I think that change should be in release 3.2, where I still see the warning (although that's not using a clang built from that source), so I don't think that the fix for that bug removes the warning in this case.
[1] http://llvm.org/git/clang.git