All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: don't warn about packed members
@ 2019-12-16 21:52 Dave Chinner
  2019-12-17 11:54 ` Brian Foster
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Dave Chinner @ 2019-12-16 21:52 UTC (permalink / raw)
  To: linux-xfs

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  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
  2020-01-26 11:02 ` Christoph Hellwig
  2020-03-13 14:07 ` Eric Sandeen
  2 siblings, 1 reply; 13+ messages in thread
From: Brian Foster @ 2019-12-17 11:54 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs

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..

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
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2019-12-17 11:54 ` Brian Foster
@ 2019-12-17 17:09   ` Darrick J. Wong
  0 siblings, 0 replies; 13+ messages in thread
From: Darrick J. Wong @ 2019-12-17 17:09 UTC (permalink / raw)
  To: Brian Foster; +Cc: Dave Chinner, linux-xfs

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2019-12-16 21:52 [PATCH] xfsprogs: don't warn about packed members Dave Chinner
  2019-12-17 11:54 ` Brian Foster
@ 2020-01-26 11:02 ` Christoph Hellwig
  2020-01-27 17:43   ` Eric Sandeen
  2020-03-13 14:07 ` Eric Sandeen
  2 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2020-01-26 11:02 UTC (permalink / raw)
  To: Eric Sandeen, Dave Chinner; +Cc: linux-xfs

Eric, can you pick this one up?  The warnings are fairly annoying..

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  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
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Sandeen @ 2020-01-27 17:43 UTC (permalink / raw)
  To: Christoph Hellwig, Dave Chinner; +Cc: linux-xfs

On 1/26/20 5:02 AM, Christoph Hellwig wrote:
> Eric, can you pick this one up?  The warnings are fairly annoying..
> 

Sorry, I had missed this one and/or the feedback on the original patch
wasn't resolved.  I tend to agree that turning off the warning globally
because we know /this/ one is OK seems somewhat suboptimal.

Let me take a look again.

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-01-27 17:43   ` Eric Sandeen
@ 2020-01-29  6:46     ` Christoph Hellwig
  2020-03-12 14:09     ` Christoph Hellwig
  1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2020-01-29  6:46 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Dave Chinner, linux-xfs

On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
> > Eric, can you pick this one up?  The warnings are fairly annoying..
> > 
> 
> Sorry, I had missed this one and/or the feedback on the original patch
> wasn't resolved.  I tend to agree that turning off the warning globally
> because we know /this/ one is OK seems somewhat suboptimal.
> 
> Let me take a look again.

Well, the kernel certainly runs with this warning disabled, mostly
because it really isn't a very useful warning to start with.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2020-03-12 14:09 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Dave Chinner, linux-xfs

On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
> > Eric, can you pick this one up?  The warnings are fairly annoying..
> > 
> 
> Sorry, I had missed this one and/or the feedback on the original patch
> wasn't resolved.  I tend to agree that turning off the warning globally
> because we know /this/ one is OK seems somewhat suboptimal.
> 
> Let me take a look again.

Can we get this queued up in xfsprogs?  These warnings are pretty
annoying..

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-03-12 14:09     ` Christoph Hellwig
@ 2020-03-13 14:06       ` Eric Sandeen
  2020-04-24 10:33         ` Christoph Hellwig
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2020-03-13 14:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Dave Chinner, linux-xfs

On 3/12/20 9:09 AM, Christoph Hellwig wrote:
> On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
>> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
>>> Eric, can you pick this one up?  The warnings are fairly annoying..
>>>
>>
>> Sorry, I had missed this one and/or the feedback on the original patch
>> wasn't resolved.  I tend to agree that turning off the warning globally
>> because we know /this/ one is OK seems somewhat suboptimal.
>>
>> Let me take a look again.
> 
> Can we get this queued up in xfsprogs?  These warnings are pretty
> annoying..


Ok.  I don't really like disabling it globally but if it's good enough
for the kernel... I'll add this to 5.5.0 and push out the release.

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2019-12-16 21:52 [PATCH] xfsprogs: don't warn about packed members Dave Chinner
  2019-12-17 11:54 ` Brian Foster
  2020-01-26 11:02 ` Christoph Hellwig
@ 2020-03-13 14:07 ` Eric Sandeen
  2 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2020-03-13 14:07 UTC (permalink / raw)
  To: Dave Chinner, linux-xfs

On 12/16/19 3:52 PM, 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 guess if it's good enough for the kernel ...

I'll probably add a short note to the commit, and

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-03-13 14:06       ` Eric Sandeen
@ 2020-04-24 10:33         ` Christoph Hellwig
  2020-04-24 17:42           ` Darrick J. Wong
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2020-04-24 10:33 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Dave Chinner, linux-xfs

On Fri, Mar 13, 2020 at 09:06:38AM -0500, Eric Sandeen wrote:
> On 3/12/20 9:09 AM, Christoph Hellwig wrote:
> > On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
> >> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
> >>> Eric, can you pick this one up?  The warnings are fairly annoying..
> >>>
> >>
> >> Sorry, I had missed this one and/or the feedback on the original patch
> >> wasn't resolved.  I tend to agree that turning off the warning globally
> >> because we know /this/ one is OK seems somewhat suboptimal.
> >>
> >> Let me take a look again.
> > 
> > Can we get this queued up in xfsprogs?  These warnings are pretty
> > annoying..
> 
> 
> Ok.  I don't really like disabling it globally but if it's good enough
> for the kernel... I'll add this to 5.5.0 and push out the release.

Seems like this still isn't in xfsprogs for-next.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-04-24 10:33         ` Christoph Hellwig
@ 2020-04-24 17:42           ` Darrick J. Wong
  2020-04-24 17:52             ` Eric Sandeen
  0 siblings, 1 reply; 13+ messages in thread
From: Darrick J. Wong @ 2020-04-24 17:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Eric Sandeen, Dave Chinner, linux-xfs

On Fri, Apr 24, 2020 at 03:33:23AM -0700, Christoph Hellwig wrote:
> On Fri, Mar 13, 2020 at 09:06:38AM -0500, Eric Sandeen wrote:
> > On 3/12/20 9:09 AM, Christoph Hellwig wrote:
> > > On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
> > >> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
> > >>> Eric, can you pick this one up?  The warnings are fairly annoying..
> > >>>
> > >>
> > >> Sorry, I had missed this one and/or the feedback on the original patch
> > >> wasn't resolved.  I tend to agree that turning off the warning globally
> > >> because we know /this/ one is OK seems somewhat suboptimal.
> > >>
> > >> Let me take a look again.
> > > 
> > > Can we get this queued up in xfsprogs?  These warnings are pretty
> > > annoying..
> > 
> > 
> > Ok.  I don't really like disabling it globally but if it's good enough
> > for the kernel... I'll add this to 5.5.0 and push out the release.
> 
> Seems like this still isn't in xfsprogs for-next.

Odd, it's in origin/master in my tree as the last commit before v5.5.0:
845e5ef706cb7e29259d6541f43a7029e7dc7898.

--D

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-04-24 17:42           ` Darrick J. Wong
@ 2020-04-24 17:52             ` Eric Sandeen
  2020-04-25  7:16               ` Christoph Hellwig
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2020-04-24 17:52 UTC (permalink / raw)
  To: Darrick J. Wong, Christoph Hellwig; +Cc: Dave Chinner, linux-xfs



On 4/24/20 12:42 PM, Darrick J. Wong wrote:
> On Fri, Apr 24, 2020 at 03:33:23AM -0700, Christoph Hellwig wrote:
>> On Fri, Mar 13, 2020 at 09:06:38AM -0500, Eric Sandeen wrote:
>>> On 3/12/20 9:09 AM, Christoph Hellwig wrote:
>>>> On Mon, Jan 27, 2020 at 11:43:02AM -0600, Eric Sandeen wrote:
>>>>> On 1/26/20 5:02 AM, Christoph Hellwig wrote:
>>>>>> Eric, can you pick this one up?  The warnings are fairly annoying..
>>>>>>
>>>>>
>>>>> Sorry, I had missed this one and/or the feedback on the original patch
>>>>> wasn't resolved.  I tend to agree that turning off the warning globally
>>>>> because we know /this/ one is OK seems somewhat suboptimal.
>>>>>
>>>>> Let me take a look again.
>>>>
>>>> Can we get this queued up in xfsprogs?  These warnings are pretty
>>>> annoying..
>>>
>>>
>>> Ok.  I don't really like disabling it globally but if it's good enough
>>> for the kernel... I'll add this to 5.5.0 and push out the release.
>>
>> Seems like this still isn't in xfsprogs for-next.
> 
> Odd, it's in origin/master in my tree as the last commit before v5.5.0:
> 845e5ef706cb7e29259d6541f43a7029e7dc7898.

seems like it's in for-next, no?

https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/tree/include/builddefs.in?h=for-next#n16

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] xfsprogs: don't warn about packed members
  2020-04-24 17:52             ` Eric Sandeen
@ 2020-04-25  7:16               ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2020-04-25  7:16 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Darrick J. Wong, Christoph Hellwig, Dave Chinner, linux-xfs

On Fri, Apr 24, 2020 at 12:52:45PM -0500, Eric Sandeen wrote:
> seems like it's in for-next, no?
> 
> https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/tree/include/builddefs.in?h=for-next#n16

Indeed it is.  I still saw the warnings, though, but a "make realclean"
fixed that.   Oh the joys of build systems..

Sorry for the noise.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-04-25  7:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.