* [PATCH] fix some compiler warnings (field width, unused variable)
@ 2006-05-31 16:00 Atsushi Nemoto
2006-05-31 16:47 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2006-05-31 16:00 UTC (permalink / raw)
To: linux-mips; +Cc: ralf
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@mba.ocn.ne.jp>
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",
- sizeof(long) * 2,
+ (int)(sizeof(long) * 2),
(unsigned long long)CPHYSADDR(initrd_end),
- sizeof(long) * 2,
+ (int)(sizeof(long) * 2),
(unsigned long long)PFN_PHYS(max_low_pfn));
initrd_start = initrd_end = 0;
initrd_reserve_bootmem = 0;
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 8f4fdd9..5e8a18a 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -276,8 +276,7 @@ void sys_set_thread_area(unsigned long a
asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
{
- int tmp, len;
- char __user *name;
+ int tmp;
switch(cmd) {
case MIPS_ATOMIC_SET:
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c
index a1962eb..39a71de 100644
--- a/arch/mips/math-emu/dp_fint.c
+++ b/arch/mips/math-emu/dp_fint.c
@@ -29,7 +29,9 @@
ieee754dp ieee754dp_fint(int x)
{
- COMPXDP;
+ u64 xm;
+ int xe;
+ int xs;
CLEARCX;
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c
index eae90a8..f08f223 100644
--- a/arch/mips/math-emu/dp_flong.c
+++ b/arch/mips/math-emu/dp_flong.c
@@ -29,7 +29,9 @@
ieee754dp ieee754dp_flong(s64 x)
{
- COMPXDP;
+ u64 xm;
+ int xe;
+ int xs;
CLEARCX;
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c
index 7aac13a..e88e125 100644
--- a/arch/mips/math-emu/sp_fint.c
+++ b/arch/mips/math-emu/sp_fint.c
@@ -29,7 +29,9 @@
ieee754sp ieee754sp_fint(int x)
{
- COMPXSP;
+ unsigned xm;
+ int xe;
+ int xs;
CLEARCX;
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c
index 3d6c1d1..26d6919 100644
--- a/arch/mips/math-emu/sp_flong.c
+++ b/arch/mips/math-emu/sp_flong.c
@@ -29,7 +29,9 @@
ieee754sp ieee754sp_flong(s64 x)
{
- COMPXDP; /* <--- need 64-bit mantissa temp */
+ u64 xm; /* <--- need 64-bit mantissa temp */
+ int xe;
+ int xs;
CLEARCX;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fix some compiler warnings (field width, unused variable)
2006-05-31 16:00 [PATCH] fix some compiler warnings (field width, unused variable) Atsushi Nemoto
@ 2006-05-31 16:47 ` Geert Uytterhoeven
2006-06-01 16:54 ` Atsushi Nemoto
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2006-05-31 16:47 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: Linux/MIPS Development, Ralf Baechle
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@mba.ocn.ne.jp>
>
> 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@linux-m68k.org
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix some compiler warnings (field width, unused variable)
2006-05-31 16:47 ` Geert Uytterhoeven
@ 2006-06-01 16:54 ` Atsushi Nemoto
2006-06-07 9:03 ` Ulrich Eckhardt
0 siblings, 1 reply; 5+ messages in thread
From: Atsushi Nemoto @ 2006-06-01 16:54 UTC (permalink / raw)
To: geert; +Cc: linux-mips, ralf
On Wed, 31 May 2006 18:47:54 +0200 (CEST), Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > 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.
Thanks. Though Ralf already committed it with slight changes, this
patch will make kernel just a bit smaller.
[MIPS] simplify printk format string (use %p instead of %0*Lx)
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 397a70e..4ab4bd5 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -420,18 +420,15 @@ static inline void bootmem_init(void)
if (initrd_start) {
unsigned long initrd_size = ((unsigned char *)initrd_end) -
((unsigned char *)initrd_start);
- const int width = sizeof(long) * 2;
printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
(void *)initrd_start, initrd_size);
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",
- width,
- (unsigned long long) CPHYSADDR(initrd_end),
- width,
- (unsigned long long) PFN_PHYS(max_low_pfn));
+ "(0x%p > 0x%p)\ndisabling initrd\n",
+ (void *)CPHYSADDR(initrd_end),
+ (void *)PFN_PHYS(max_low_pfn));
initrd_start = initrd_end = 0;
initrd_reserve_bootmem = 0;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fix some compiler warnings (field width, unused variable)
2006-06-01 16:54 ` Atsushi Nemoto
@ 2006-06-07 9:03 ` Ulrich Eckhardt
2006-06-07 14:58 ` Atsushi Nemoto
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Eckhardt @ 2006-06-07 9:03 UTC (permalink / raw)
To: linux-mips
On Thursday 01 June 2006 18:54, Atsushi Nemoto wrote:
> printk("initrd extends beyond end of memory "
> - "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",
> - width,
> - (unsigned long long) CPHYSADDR(initrd_end),
> - width,
> - (unsigned long long) PFN_PHYS(max_low_pfn));
> + "(0x%p > 0x%p)\ndisabling initrd\n",
> + (void *)CPHYSADDR(initrd_end),
> + (void *)PFN_PHYS(max_low_pfn));
I'm not so sure if this is a good idea because some systems have 36 bit
physical addresses while they only have 32 bit void pointers, so long long is
probably really the better solution.
I'm wondering if it would be worth having a special flag in printk to indicate
a physical address ("%lp" perhaps?) so that you don't get the unimportant
leading zeroes for the bits 36 to 63 for above mentioned platforms.
Uli
****************************************************
Visit our website at <http://www.domino-printing.com/>
****************************************************
This Email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this Email in error please notify the system manager.
This footnote also confirms that this Email message has been swept by MailSweeper for the presence of computer viruses.
****************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix some compiler warnings (field width, unused variable)
2006-06-07 9:03 ` Ulrich Eckhardt
@ 2006-06-07 14:58 ` Atsushi Nemoto
0 siblings, 0 replies; 5+ messages in thread
From: Atsushi Nemoto @ 2006-06-07 14:58 UTC (permalink / raw)
To: eckhardt; +Cc: linux-mips
On Wed, 7 Jun 2006 11:03:34 +0200, Ulrich Eckhardt <eckhardt@satorlaser.com> wrote:
> I'm not so sure if this is a good idea because some systems have 36
> bit physical addresses while they only have 32 bit void pointers, so
> long long is probably really the better solution.
In general, it would be better to use "long long" for 32bit physical
address. For this particular code, both values are "unsigned long" so
casting to "void *" for printing should be safe anyway.
> I'm wondering if it would be worth having a special flag in printk
> to indicate a physical address ("%lp" perhaps?) so that you don't
> get the unimportant leading zeroes for the bits 36 to 63 for above
> mentioned platforms.
It might raise some new gcc/sparse warnings about format strings :-)
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-06-07 14:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 16:00 [PATCH] fix some compiler warnings (field width, unused variable) Atsushi Nemoto
2006-05-31 16:47 ` Geert Uytterhoeven
2006-06-01 16:54 ` Atsushi Nemoto
2006-06-07 9:03 ` Ulrich Eckhardt
2006-06-07 14:58 ` Atsushi Nemoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.