From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfsprogs: don't warn about packed members
Date: Tue, 17 Dec 2019 09:09:05 -0800 [thread overview]
Message-ID: <20191217170905.GC12765@magnolia> (raw)
In-Reply-To: <20191217115401.GC48778@bfoster>
On Tue, Dec 17, 2019 at 06:54:01AM -0500, Brian Foster wrote:
> On Tue, Dec 17, 2019 at 08:52:45AM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > gcc 9.2.1 throws lots of new warnings during the build like this:
> >
> > xfs_format.h:790:3: warning: taking address of packed member of ‘struct xfs_agfl’ may result in an unaligned pointer value [-Waddress-of-packed-member]
> > 790 | &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > xfs_alloc.c:3149:13: note: in expansion of macro ‘XFS_BUF_TO_AGFL_BNO’
> > 3149 | agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, agflbp);
> > | ^~~~~~~~~~~~~~~~~~~
> >
> > We know this packed structure aligned correctly, so turn off this
> > warning to shut gcc up.
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
>
> I'm wondering if we could just use offsetof() in this case so we don't
> have to disable a warning for the entire project, particularly if this
> is triggered by a small number of macros..
...and maybe kill the shouty macro while we're at it. :)
--D
> Brian
>
> > include/builddefs.in | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/builddefs.in b/include/builddefs.in
> > index 4700b52706a7..6fdc9ebb70c7 100644
> > --- a/include/builddefs.in
> > +++ b/include/builddefs.in
> > @@ -13,7 +13,7 @@ OPTIMIZER = @opt_build@
> > MALLOCLIB = @malloc_lib@
> > LOADERFLAGS = @LDFLAGS@
> > LTLDFLAGS = @LDFLAGS@
> > -CFLAGS = @CFLAGS@ -D_FILE_OFFSET_BITS=64
> > +CFLAGS = @CFLAGS@ -D_FILE_OFFSET_BITS=64 -Wno-address-of-packed-member
> > BUILD_CFLAGS = @BUILD_CFLAGS@ -D_FILE_OFFSET_BITS=64
> >
> > LIBRT = @librt@
> > --
> > 2.24.0.rc0
> >
>
next prev parent reply other threads:[~2019-12-17 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-16 21:52 [PATCH] xfsprogs: don't warn about packed members Dave Chinner
2019-12-17 11:54 ` Brian Foster
2019-12-17 17:09 ` Darrick J. Wong [this message]
2020-01-26 11:02 ` Christoph Hellwig
2020-01-27 17:43 ` Eric Sandeen
2020-01-29 6:46 ` Christoph Hellwig
2020-03-12 14:09 ` Christoph Hellwig
2020-03-13 14:06 ` Eric Sandeen
2020-04-24 10:33 ` Christoph Hellwig
2020-04-24 17:42 ` Darrick J. Wong
2020-04-24 17:52 ` Eric Sandeen
2020-04-25 7:16 ` Christoph Hellwig
2020-03-13 14:07 ` Eric Sandeen
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=20191217170905.GC12765@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/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