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

Jon Loeliger jdl at jdl.com
Tue Oct 23 02:50:52 EST 2007


So, like, the other day David Gibson mumbled:
> On Sat, Oct 20, 2007 at 10:51:29AM +0200, Andreas Schwab wrote:
> > David Gibson <david at gibson.dropbear.id.au> 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



More information about the Linuxppc-dev mailing list