* [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c
@ 2006-07-31 10:20 Dirk Behme
2006-07-31 12:39 ` Paul Brook
0 siblings, 1 reply; 4+ messages in thread
From: Dirk Behme @ 2006-07-31 10:20 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
Fix warnings
hw/mips_r4k.c: In function ‘mips_r4kc_init’:
hw/mips_r4k.c:230: warning: pointer targets in passing
argument 3 of ‘load_elf’ differ in signedness
hw/mips_r4k.c:256: warning: pointer targets in passing
argument 1 of ‘strcpy’ differ in signedness
[-- Attachment #2: mips_r4k_warning.patch --]
[-- Type: text/x-patch, Size: 810 bytes --]
--- ./hw/mips_r4k.c_orig 2006-07-31 12:11:32.000000000 +0200
+++ ./hw/mips_r4k.c 2006-07-31 12:14:55.000000000 +0200
@@ -195,7 +195,7 @@ void mips_r4kc_init (int ram_size, int v
const char *initrd_filename)
{
char buf[1024];
- int64_t entry = 0;
+ uint64_t entry = 0;
unsigned long bios_offset;
int io_memory;
int ret;
@@ -253,7 +253,7 @@ void mips_r4kc_init (int ram_size, int v
}
/* Store command line. */
- strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+ strcpy ((char *)phys_ram_base + (16 << 20) - 256, kernel_cmdline);
/* FIXME: little endian support */
*(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
*(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c
2006-07-31 10:20 [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c Dirk Behme
@ 2006-07-31 12:39 ` Paul Brook
2006-07-31 13:18 ` Dirk Behme
0 siblings, 1 reply; 4+ messages in thread
From: Paul Brook @ 2006-07-31 12:39 UTC (permalink / raw)
To: qemu-devel
On Monday 31 July 2006 11:20, Dirk Behme wrote:
> Fix warnings
>
> hw/mips_r4k.c: In function ‘mips_r4kc_init’:
> hw/mips_r4k.c:230: warning: pointer targets in passing
> argument 3 of ‘load_elf’ differ in signedness
> hw/mips_r4k.c:256: warning: pointer targets in passing
> argument 1 of ‘strcpy’ differ in signedness
Compile with -Wno-pointer-sign. gcc4 isn't really supported anyway.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c
2006-07-31 12:39 ` Paul Brook
@ 2006-07-31 13:18 ` Dirk Behme
2006-07-31 13:33 ` Paul Brook
0 siblings, 1 reply; 4+ messages in thread
From: Dirk Behme @ 2006-07-31 13:18 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
Paul Brook wrote:
> On Monday 31 July 2006 11:20, Dirk Behme wrote:
>
>>Fix warnings
>>
>>hw/mips_r4k.c: In function ‘mips_r4kc_init’:
>>hw/mips_r4k.c:230: warning: pointer targets in passing
>>argument 3 of ‘load_elf’ differ in signedness
>>hw/mips_r4k.c:256: warning: pointer targets in passing
>>argument 1 of ‘strcpy’ differ in signedness
>
> Compile with -Wno-pointer-sign. gcc4 isn't really supported anyway.
Yes, I know ;) And yes, I know there are technical reasons
for not supporting gcc4.
But do you wan't to say that at places, where because of
typos or lazy programming and thus no technical reason for
it (e.g. passing signed where calling function wants
unsigned) it is better to disable warning with
-Wno-pointer-sign instead of fixing it?
Note that I haven't fixed a lot of other similar warnings
where there may be technical reasons for it. But in this
file I thought its worth fixing and improving code quality.
Regards
Dirk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c
2006-07-31 13:18 ` Dirk Behme
@ 2006-07-31 13:33 ` Paul Brook
0 siblings, 0 replies; 4+ messages in thread
From: Paul Brook @ 2006-07-31 13:33 UTC (permalink / raw)
To: Dirk Behme; +Cc: qemu-devel
> >>hw/mips_r4k.c:256: warning: pointer targets in passing
> >>argument 1 of ‘strcpy’ differ in signedness
> >
> > Compile with -Wno-pointer-sign. gcc4 isn't really supported anyway.
>
> Yes, I know ;) And yes, I know there are technical reasons
> for not supporting gcc4.
>
> But do you wan't to say that at places, where because of
> typos or lazy programming and thus no technical reason for
> it (e.g. passing signed where calling function wants
> unsigned) it is better to disable warning with
> -Wno-pointer-sign instead of fixing it?
I'm saying that this warning occurs in sufficiently many places, many of which
are questionable, that it's best to just turn it off.
The entry change is maybe acceptable. The strcpy change just uglifies the
code.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-31 13:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 10:20 [Qemu-devel] [PATCH] Fix warnings in mips_r4k.c Dirk Behme
2006-07-31 12:39 ` Paul Brook
2006-07-31 13:18 ` Dirk Behme
2006-07-31 13:33 ` Paul Brook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).