DTC: Appease the printf() format $Gods with a correct type.
PATCH 3/4 DTC: Appease the printf() format $Gods with a correct type.
--- tests/get_name.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tests/get_name.c +1 -1
@@ -55,7 +55,7 @@ void check_name(void *fdt, const char *path)if (len !=strlen (getname))FAIL ("fdt_get_name(%s) returned length %d instead of %d" , - path, len,strlen (getname)); + path, len, (int )strlen (getname));/* Now check that it doesn't break if we omit len */ getname2 =fdt_get_name (fdt, offset,NULL );
Signature · 1 line
1.5.3.1.139.g9346b
Quoted 2 lines · Jon Loeliger
Signed-off-by Jon Loeliger <[email protected]>
Hrm.... I'm very dubious about this.
What compiler/platform is this? I can't off the top of my head think of one where size_t shouldn't be promoted to int automatically. Or there's the %z modifier, which explicitly specifies a size_t, but I'm not sure if that's C99 or a glibc extension.
Quoted 17 lines
--- tests/get_name.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tests/get_name.c +1
-1@@ -55,7 +55,7 @@ void check_name(void *fdt, const char *path)if (len !=strlen (getname))FAIL ("fdt_get_name(%s) returned length %d instead of %d" , - path, len,strlen (getname)); + path, len, (int )strlen (getname));/* Now check that it doesn't break if we omit len */ getname2 =fdt_get_name (fdt, offset,NULL );
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 2 lines · David Gibson
What compiler/platform is this? I can't off the top of my head think of one where
size_tshouldn't be promoted to int automatically.
Only types narrower than int are subject to integer promotion.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 6 lines · Andreas Schwab
Quoted 2 lines · David Gibson
What compiler/platform is this? I can't off the top of my head think of one where
size_tshouldn't be promoted to int automatically.Only types narrower than int are subject to integer promotion.
Duh, yes. Sorry.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
So, like, the other day David Gibson mumbled:
Quoted 9 lines · Andreas Schwab
Quoted 6 lines
Quoted 2 lines · David Gibson
What compiler/platform is this? I can't off the top of my head think of one where
size_tshouldn't be promoted to int automatically.Only types narrower than int are subject to integer promotion.
Duh, yes. Sorry.
So, Hmm. You want the patch as I wrote it applied? Or do you want to use %z in the format instead? It does seem like there is precedent to do that (in the kernel):
% grep -r '%z' arch/
arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
arch/m68k/ifpsp060/src/itest.S: mulu.l (0x00.w,%a3,%za4.l*8),%d2:%d3
arch/m68k/ifpsp060/src/itest.S: mulu.l (-0x10.w,%za3,%a4.l*1),%d2:%d3
arch/m68k/ifpsp060/src/itest.S: mulu.l (ea_77_mem+0x00.w,%pc,%za4.l*8),%d2:%d3
...
arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc,%zd4.l*1]),%d2:%d3
arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%pc],%zd4.l*8,0x20.l),%d2:%d3
arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc],%d4.l*8),%d2:%d3
arch/um/drivers/cow_user.c: /* Below, %zd is for a size_t value */
arch/um/drivers/cow_user.c: "limited to %zd characters\n", backing_file,
arch/x86/kernel/pci-nommu_64.c: "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",Opinions?
Thanks,
jdl
Quoted 29 lines · On Mon, 22 Oct 2007 11:50:52 -0500 Jon Loeliger <[email protected]> wrote:
So, like, the other day David Gibson mumbled:
Quoted 9 lines · Andreas Schwab
Quoted 6 lines
Quoted 2 lines · David Gibson
What compiler/platform is this? I can't off the top of my head think of one where
size_tshouldn't be promoted to int automatically.Only types narrower than int are subject to integer promotion.
Duh, yes. Sorry.
So, Hmm. You want the patch as I wrote it applied? Or do you want to use %z in the format instead? It does seem like there is precedent to do that (in the kernel):
% grep -r '%z' arch/ arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread); arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread); arch/m68k/ifpsp060/src/itest.S: mulu.l (0x00.w,%a3,%za4.l*8),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l (-0x10.w,%za3,%a4.l*1),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l (ea_77_mem+0x00.w,%pc,%za4.l*8),%d2:%d3 ... arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc,%zd4.l*1]),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%pc],%zd4.l*8,0x20.l),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc],%d4.l*8),%d2:%d3 arch/um/drivers/cow_user.c: /* Below, %zd is for a size_t value */ arch/um/drivers/cow_user.c: "limited to %zd characters\n", backing_file, arch/x86/kernel/pci-nommu_64.c: "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
Quoted 1 line
Opinions?
%z is fairly common now-a-days. The kernel janitors tend to LART people for not using it rather quickly.
josh
Quoted 32 lines · Josh Boyer
Quoted 29 lines · On Mon, 22 Oct 2007 11:50:52 -0500 Jon Loeliger <[email protected]> wrote:
So, like, the other day David Gibson mumbled:
Quoted 9 lines · Andreas Schwab
Quoted 6 lines
Quoted 2 lines · David Gibson
What compiler/platform is this? I can't off the top of my head think of one where
size_tshouldn't be promoted to int automatically.Only types narrower than int are subject to integer promotion.
Duh, yes. Sorry.
So, Hmm. You want the patch as I wrote it applied? Or do you want to use %z in the format instead? It does seem like there is precedent to do that (in the kernel):
% grep -r '%z' arch/ arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread); arch/alpha/boot/tools/mkbb.c: fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread); arch/m68k/ifpsp060/src/itest.S: mulu.l (0x00.w,%a3,%za4.l*8),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l (-0x10.w,%za3,%a4.l*1),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l (ea_77_mem+0x00.w,%pc,%za4.l*8),%d2:%d3 ... arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc,%zd4.l*1]),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%pc],%zd4.l*8,0x20.l),%d2:%d3 arch/m68k/ifpsp060/src/itest.S: mulu.l ([EASTORE.l,%zpc],%d4.l*8),%d2:%d3 arch/um/drivers/cow_user.c: /* Below, %zd is for a size_t value */ arch/um/drivers/cow_user.c: "limited to %zd characters\n", backing_file, arch/x86/kernel/pci-nommu_64.c: "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
Quoted 4 lines
Quoted 1 line
Opinions?
%z is fairly common now-a-days. The kernel janitors tend to LART people for not using it rather quickly.
Yes, I think %z is preferable. It used to be a glibc (et al) extension, but I think it's now specified in C99 (we should double check that).
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 3 lines
Yes, I think %z is preferable. It used to be a glibc (et al) extension, but I think it's now specified in C99 (we should double check that).
It is.
Segher