linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-xfs@vger.kernel.org,
	Linux-Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-next: build warning after merge of the xfs tree
Date: Fri, 1 Sep 2017 07:32:07 +1000	[thread overview]
Message-ID: <20170831213207.GP10621@dastard> (raw)
In-Reply-To: <20170831152220.GF21939@bfoster.bfoster>

On Thu, Aug 31, 2017 at 11:22:20AM -0400, Brian Foster wrote:
> On Thu, Aug 31, 2017 at 07:57:52AM -0700, Darrick J. Wong wrote:
> > On Thu, Aug 31, 2017 at 06:30:41AM -0400, Brian Foster wrote:
> > > On Thu, Aug 31, 2017 at 10:07:03AM +1000, Stephen Rothwell wrote:
> > > > Hi all,
> > > > 
> > > > After merging the xfs tree, today's linux-next build (powerpc
> > > > ppc64_defconfig) produced this warning:
> > > > 
> > > > fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
> > > > fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]
> > > >   bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
> > > >          ^
> > > > 
> > > > Introduced by commit
> > > > 
> > > >   a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")
> > > > 
> > > 
> > > Ugh, this is due to the refactoring of this patch between v1 and v2. I
> > > specifically recall testing for this in v1 because I added the ordered
> > > bool purely to clean up the ASSERT(), then I apparently lost of track of
> > > it for v2.
> > > 
> > > Anyways.. Christoph, Darrick, preferences to clean this up..? I have no
> > > preference between the v1 or v2 factoring. Or if it's easier, we could
> > > always just drop something like the hunk below on top. Thoughts?
> > > 
> > > Brian
> > > 
> > > --- 8< ---
> > > 
> > > diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
> > > index ef2c137..f5d25f5 100644
> > > --- a/fs/xfs/xfs_buf_item.c
> > > +++ b/fs/xfs/xfs_buf_item.c
> > > @@ -567,10 +567,15 @@ xfs_buf_item_unlock(
> > >  {
> > >  	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
> > >  	struct xfs_buf		*bp = bip->bli_buf;
> > > -	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
> > > -	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
> > > -	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
> > > -	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
> > > +	bool			aborted;
> > > +	bool			hold;
> > > +	bool			dirty;
> > > +	bool			ordered;
> > > +
> > > +	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
> > > +	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
> > > +	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
> > > +	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
> > 
> > The trouble is, 'ordered' is still an unused variable on !DEBUG builds,
> > since the only user of ordered is that ASSERT.  So either we #ifdef
> > DEBUG the variable out of existence or employ one of those silly
> > 'ordered = ordered' constructions to shut up gcc, if that even still
> > works.
> > 
> 
> The warning goes away for me if we separate the initialization of
> ordered from the declaration. Do you observe otherwise?

Various versions of gcc will throw set-but-unused warnings on
this. Just #define it away or factor the debug code into another
function.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2017-08-31 21:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31  0:07 linux-next: build warning after merge of the xfs tree Stephen Rothwell
2017-08-31 10:30 ` Brian Foster
2017-08-31 14:57   ` Darrick J. Wong
2017-08-31 15:22     ` Brian Foster
2017-08-31 15:41       ` Darrick J. Wong
2017-08-31 21:32       ` Dave Chinner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-23  4:36 Stephen Rothwell
2024-02-23  6:35 ` Christoph Hellwig
2024-02-23  8:55   ` Mauro Carvalho Chehab
2024-02-23 14:06     ` Christoph Hellwig
2024-02-24  9:07       ` Akira Yokosawa
2024-02-26 10:57         ` Christoph Hellwig
2021-06-07  0:48 Stephen Rothwell
2021-06-07  1:15 ` Dave Chinner
2021-02-08 12:44 Stephen Rothwell
2021-01-24 22:55 Stephen Rothwell
2021-01-25 13:26 ` Brian Foster
2021-01-27  3:14   ` Darrick J. Wong
2020-05-08  1:15 Stephen Rothwell
2020-01-16  0:37 Stephen Rothwell
2020-01-15 22:12 Stephen Rothwell
2020-01-24  2:47 ` Stephen Rothwell
2020-01-24  4:17   ` Darrick J. Wong
2017-10-31 22:42 Stephen Rothwell
2010-03-04  0:19 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170831213207.GP10621@dastard \
    --to=david@fromorbit.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).