Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-22 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
 On Sat, Oct 20, 2007 at 10:51:29AM +0200, Andreas Schwab wrote:
  David Gibson [EMAIL PROTECTED] writes:
  
   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.
  
  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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-22 Thread Josh Boyer
On Mon, 22 Oct 2007 11:50:52 -0500
Jon Loeliger [EMAIL PROTECTED] wrote:

 So, like, the other day David Gibson mumbled:
  On Sat, Oct 20, 2007 at 10:51:29AM +0200, Andreas Schwab wrote:
   David Gibson [EMAIL PROTECTED] writes:
   
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.
   
   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?

%z is fairly common now-a-days.  The kernel janitors tend to LART
people for not using it rather quickly.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-22 Thread David Gibson
On Mon, Oct 22, 2007 at 11:55:11AM -0500, Josh Boyer wrote:
 On Mon, 22 Oct 2007 11:50:52 -0500
 Jon Loeliger [EMAIL PROTECTED] wrote:
 
  So, like, the other day David Gibson mumbled:
   On Sat, Oct 20, 2007 at 10:51:29AM +0200, Andreas Schwab wrote:
David Gibson [EMAIL PROTECTED] writes:

 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.

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?
 
 %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).

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-22 Thread Segher Boessenkool
 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

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-20 Thread David Gibson
On Fri, Oct 19, 2007 at 12:43:13PM -0500, Jon Loeliger wrote:
 
 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.


 ---
  tests/get_name.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/tests/get_name.c b/tests/get_name.c
 index 2481741..a76bdf8 100644
 --- a/tests/get_name.c
 +++ b/tests/get_name.c
 @@ -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);

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-20 Thread Andreas Schwab
David Gibson [EMAIL PROTECTED] writes:

 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.

Only types narrower than int are subject to integer promotion.

Andreas.

-- 
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.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] DTC: Appease the printf() format $Gods with a correct type.

2007-10-20 Thread David Gibson
On Sat, Oct 20, 2007 at 10:51:29AM +0200, Andreas Schwab wrote:
 David Gibson [EMAIL PROTECTED] writes:
 
  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.
 
 Only types narrower than int are subject to integer promotion.

Duh, yes.  Sorry.

-- 
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
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev