linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
	Christian Brauner <brauner@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: linux-next: build warnings after merge of the vfs-brauner tree
Date: Thu, 19 Dec 2024 07:40:05 -0500	[thread overview]
Message-ID: <fb6ada81454134c8a37aec7cef17b7c068ebdf85.camel@kernel.org> (raw)
In-Reply-To: <20241219173156.7dce2f07@canb.auug.org.au>

On Thu, 2024-12-19 at 17:31 +1100, Stephen Rothwell wrote:
> Hi all,
> 
> On Wed, 11 Dec 2024 14:37:01 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > 
> > After merging the vfs-brauner tree, today's linux-next build (powerpc
> > allyesconfig) produced these warnings:
> > 
> > samples/vfs/mountinfo.c: In function 'show_propagation':
> > samples/vfs/mountinfo.c:104:36: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
> >   104 |                 printf(" shared:%llu", sm->mnt_peer_group);
> >       |                                 ~~~^   ~~~~~~~~~~~~~~~~~~
> >       |                                    |     |
> >       |                                    |     __u64 {aka long unsigned int}
> >       |                                    long long unsigned int
> >       |                                 %lu
> > samples/vfs/mountinfo.c:106:36: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
> >   106 |                 printf(" master:%llu", sm->mnt_master);
> >       |                                 ~~~^   ~~~~~~~~~~~~~~
> >       |                                    |     |
> >       |                                    |     __u64 {aka long unsigned int}
> >       |                                    long long unsigned int
> >       |                                 %lu
> > samples/vfs/mountinfo.c:108:52: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
> >   108 |                         printf(" propagate_from:%llu", sm->propagate_from);
> >       |                                                 ~~~^   ~~~~~~~~~~~~~~~~~~
> >       |                                                    |     |
> >       |                                                    |     __u64 {aka long unsigned int}
> >       |                                                    long long unsigned int
> >       |                                                 %lu
> > samples/vfs/mountinfo.c: In function 'dump_mountinfo':
> > samples/vfs/mountinfo.c:144:42: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type '__u64' {aka 'long unsigned int'} [-Wformat=]
> >   144 |                 printf("0x%lx 0x%lx 0x%llx ", mnt_ns_id, mnt_id, buf->mnt_parent_id);
> >       |                                       ~~~^                       ~~~~~~~~~~~~~~~~~~
> >       |                                          |                          |
> >       |                                          long long unsigned int     __u64 {aka long unsigned int}
> >       |                                       %lx
> > 
> > Introduced by commits
> > 
> >   0c8f746452aa ("samples: add a mountinfo program to demonstrate statmount()/listmount()")
> >   ee8c840a4a35 ("samples: fix missing nodiratime option and handle propagate_from correctly")
> > 
> > I am not sure why these warnings only turned up today.
> 
> I am still seeing these warnings.

I'm not sure how to fix this the right way.

The problem seems to be a discrepancy in the __u64 type between arches.
Changing these in a way that would make PPC happy causes these warnings
on x86_64:

   gcc -Wp,-MMD,./.mountinfo.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu11  -m64 -I usr/include  -m64   -o mountinfo mountinfo.c  
mountinfo.c: In function ‘show_propagation’:
mountinfo.c:104:35: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long long unsigned int’} [-Wformat=]
  104 |                 printf(" shared:%lu", sm->mnt_peer_group);
      |                                 ~~^   ~~~~~~~~~~~~~~~~~~
      |                                   |     |
      |                                   |     __u64 {aka long long unsigned int}
      |                                   long unsigned int
      |                                 %llu
mountinfo.c:106:35: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long long unsigned int’} [-Wformat=]
  106 |                 printf(" master:%lu", sm->mnt_master);
      |                                 ~~^   ~~~~~~~~~~~~~~
      |                                   |     |
      |                                   |     __u64 {aka long long unsigned int}
      |                                   long unsigned int
      |                                 %llu
mountinfo.c:108:51: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long long unsigned int’} [-Wformat=]
  108 |                         printf(" propagate_from:%lu", sm->propagate_from);
      |                                                 ~~^   ~~~~~~~~~~~~~~~~~~
      |                                                   |     |
      |                                                   |     __u64 {aka long long unsigned int}
      |                                                   long unsigned int
      |                                                 %llu
mountinfo.c: In function ‘dump_mountinfo’:
mountinfo.c:144:41: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘__u64’ {aka ‘long long unsigned int’} [-Wformat=]
  144 |                 printf("0x%lx 0x%lx 0x%lx ", mnt_ns_id, mnt_id, buf->mnt_parent_id);
      |                                       ~~^                       ~~~~~~~~~~~~~~~~~~
      |                                         |                          |
      |                                         long unsigned int          __u64 {aka long long unsigned int}
      |                                       %llx


What format specifier should we be using that would make both arches happy?

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2024-12-19 12:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  3:37 linux-next: build warnings after merge of the vfs-brauner tree Stephen Rothwell
2024-12-19  6:31 ` Stephen Rothwell
2024-12-19 12:40   ` Jeff Layton [this message]
2024-12-19 20:36     ` Stephen Rothwell
2025-01-06 13:50       ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2025-07-17  7:36 Stephen Rothwell
2025-07-22 10:24 ` Jann Horn
2025-03-05 10:07 Stephen Rothwell
2025-03-05 10:55 ` David Disseldorp
2024-12-13  4:27 Stephen Rothwell
2024-12-19  6:32 ` Stephen Rothwell
2025-01-14  5:48   ` Stephen Rothwell
2025-01-20  8:25     ` Stephen Rothwell
2025-01-20 12:15       ` Christian Brauner
2025-01-20 20:55         ` Stephen Rothwell
2024-10-09  6:29 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=fb6ada81454134c8a37aec7cef17b7c068ebdf85.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@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).