Re: linux-next: build warnings after merge of the vfs-brauner tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxx>





[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux