Re: [PATCH] fix some compiler warnings (field width, unused variable)

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

 



On Thu, 1 Jun 2006, Atsushi Nemoto wrote:
> Fix following warnings:
> linux/arch/mips/kernel/setup.c:432: warning: field width is not type int (arg 2)
> linux/arch/mips/kernel/setup.c:432: warning: field width is not type int (arg 4)
> linux/arch/mips/kernel/syscall.c:279: warning: unused variable `len'
> linux/arch/mips/kernel/syscall.c:280: warning: unused variable `name'
> linux/arch/mips/math-emu/dp_fint.c:32: warning: unused variable `xc'
> linux/arch/mips/math-emu/dp_flong.c:32: warning: unused variable `xc'
> linux/arch/mips/math-emu/sp_fint.c:32: warning: unused variable `xc'
> linux/arch/mips/math-emu/sp_flong.c:32: warning: unused variable `xc'
> 
> Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
> 
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index bcf1b10..132b65d 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -426,9 +426,9 @@ static inline void bootmem_init(void)
>  		if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) {
>  			printk("initrd extends beyond end of memory "
>  			       "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",

`%L' is obsolete for long long, use `%ll' instead.

> -			       sizeof(long) * 2,
> +			       (int)(sizeof(long) * 2),
>  			       (unsigned long long)CPHYSADDR(initrd_end),

As CPHYSADDR() returns a ptrdiff_t, what about using `%t' instead?
Ah, that one doesn't print hex (hmm, C99 doesn't seem to tell).

You can cast to `void *' and use `%p' to get hex, and the field width will
automagically be `2*sizeof(void *)', according to lib/vsprintf.c.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux