qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Avoid double definitions of PRI*64
@ 2011-06-23  8:15 Jan Kiszka
  2011-06-23 13:35 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2011-06-23  8:15 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel

From: Jan Kiszka <jan.kiszka@siemens.com>

Recent mingw32 provide those defines.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 qemu-common.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/qemu-common.h b/qemu-common.h
index 109498d..7ca7e57 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -113,12 +113,15 @@ static inline char *realpath(const char *path, char *resolved_path)
     return resolved_path;
 }
 
+#ifndef PRId64
 #define PRId64 "I64d"
 #define PRIx64 "I64x"
 #define PRIu64 "I64u"
 #define PRIo64 "I64o"
 #endif
 
+#endif
+
 /* FIXME: Remove NEED_CPU_H.  */
 #ifndef NEED_CPU_H
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Avoid double definitions of PRI*64
  2011-06-23  8:15 [Qemu-devel] [PATCH] Avoid double definitions of PRI*64 Jan Kiszka
@ 2011-06-23 13:35 ` Stefan Hajnoczi
  2011-06-23 14:32   ` Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-06-23 13:35 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-trivial, qemu-devel

On Thu, Jun 23, 2011 at 10:15:58AM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Recent mingw32 provide those defines.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  qemu-common.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

It's never too late to implement C99!

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Avoid double definitions of PRI*64
  2011-06-23 13:35 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
@ 2011-06-23 14:32   ` Stefan Weil
  2011-06-24  5:41     ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2011-06-23 14:32 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, Jan Kiszka, qemu-devel

Am 23.06.2011 15:35, schrieb Stefan Hajnoczi:
> On Thu, Jun 23, 2011 at 10:15:58AM +0200, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Recent mingw32 provide those defines.

... and all of those defines are wrong, because QEMU does not use
MS format specifiers. http://patchwork.ozlabs.org/patch/74276/
tried to fix this. My preferred solution is removing those PRI*64 from
qemu-common.h, because not only recent mingw32 versions provide
the (wrong) definitions, but even the Debian version provides them
(which is really old, but I use it for my regression tests).

The wrong definitions do not allow using -Wformat for mingw32
builds, but they work because (most?) relevant mingw32 functions
accept both MS and standard format specifiers.

Adding the correct definitions (to qemu-os-win32.h, not to qemu-common.h)
would be another solution as long as mingw32 does not handle
__USE_MINGW_ANSI_STDIO correctly.

>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> qemu-common.h | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> It's never too late to implement C99!
>
> Thanks, applied to the trivial patches tree:
> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
>
> Stefan

Stefan, the patch won't harm, but it's also unnecessary.
So it's up to you whether you remove it from your queue,
modify it as I suggested above or apply it as it is.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Avoid double definitions of PRI*64
  2011-06-23 14:32   ` Stefan Weil
@ 2011-06-24  5:41     ` Stefan Hajnoczi
  2011-06-24  6:11       ` Stefan Weil
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-06-24  5:41 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Jan Kiszka, qemu-devel

On Thu, Jun 23, 2011 at 3:32 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 23.06.2011 15:35, schrieb Stefan Hajnoczi:
>>
>> On Thu, Jun 23, 2011 at 10:15:58AM +0200, Jan Kiszka wrote:
>>>
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> Recent mingw32 provide those defines.
>
> ... and all of those defines are wrong, because QEMU does not use
> MS format specifiers. http://patchwork.ozlabs.org/patch/74276/
> tried to fix this. My preferred solution is removing those PRI*64 from
> qemu-common.h, because not only recent mingw32 versions provide
> the (wrong) definitions, but even the Debian version provides them
> (which is really old, but I use it for my regression tests).
>
> The wrong definitions do not allow using -Wformat for mingw32
> builds, but they work because (most?) relevant mingw32 functions
> accept both MS and standard format specifiers.
>
> Adding the correct definitions (to qemu-os-win32.h, not to qemu-common.h)
> would be another solution as long as mingw32 does not handle
> __USE_MINGW_ANSI_STDIO correctly.
>
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>> qemu-common.h | 3 +++
>>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> It's never too late to implement C99!
>>
>> Thanks, applied to the trivial patches tree:
>> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
>>
>> Stefan
>
> Stefan, the patch won't harm, but it's also unnecessary.
> So it's up to you whether you remove it from your queue,
> modify it as I suggested above or apply it as it is.

Keeping those #defines unconditional prevents new mingw builds from
working, according to the commit description.  So we have to either
remove them entirely or do them correctly.  Dropping this patch will
keep the build from working.

I suggest we keep this patch.  A follow-up patch can us MS format
specifiers or do any other adjustments that make this work better.
Stefan, would you be able to send that patch?

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Avoid double definitions of PRI*64
  2011-06-24  5:41     ` Stefan Hajnoczi
@ 2011-06-24  6:11       ` Stefan Weil
  2011-06-24  6:12         ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Weil @ 2011-06-24  6:11 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, Jan Kiszka, qemu-devel

Am 24.06.2011 07:41, schrieb Stefan Hajnoczi:
> On Thu, Jun 23, 2011 at 3:32 PM, Stefan Weil <weil@mail.berlios.de> wrote:
>> Am 23.06.2011 15:35, schrieb Stefan Hajnoczi:
>>>
>>> On Thu, Jun 23, 2011 at 10:15:58AM +0200, Jan Kiszka wrote:
>>>>
>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> Recent mingw32 provide those defines.
>>
>> ... and all of those defines are wrong, because QEMU does not use
>> MS format specifiers. http://patchwork.ozlabs.org/patch/74276/
>> tried to fix this. My preferred solution is removing those PRI*64 from
>> qemu-common.h, because not only recent mingw32 versions provide
>> the (wrong) definitions, but even the Debian version provides them
>> (which is really old, but I use it for my regression tests).
>>
>> The wrong definitions do not allow using -Wformat for mingw32
>> builds, but they work because (most?) relevant mingw32 functions
>> accept both MS and standard format specifiers.
>>
>> Adding the correct definitions (to qemu-os-win32.h, not to qemu-common.h)
>> would be another solution as long as mingw32 does not handle
>> __USE_MINGW_ANSI_STDIO correctly.
>>
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>> qemu-common.h | 3 +++
>>>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> It's never too late to implement C99!
>>>
>>> Thanks, applied to the trivial patches tree:
>>> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
>>>
>>> Stefan
>>
>> Stefan, the patch won't harm, but it's also unnecessary.
>> So it's up to you whether you remove it from your queue,
>> modify it as I suggested above or apply it as it is.
>
> Keeping those #defines unconditional prevents new mingw builds from
> working, according to the commit description. So we have to either
> remove them entirely or do them correctly. Dropping this patch will
> keep the build from working.
>
> I suggest we keep this patch. A follow-up patch can us MS format
> specifiers or do any other adjustments that make this work better.
> Stefan, would you be able to send that patch?
>
> Stefan

Hi Stefan,

I just did a "git blame include/inttypes.h" on cygwin/mingw32 sources
(git repository created from CVS). Here is the result:

8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  34) #define PRId64 "I64d"
8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  52) #define PRIi64 "I64i"
8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  70) #define PRIo64 "I64o"
8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  90) #define PRIu64 "I64u"
8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000 109) #define PRIx64 "I64x"
8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000 127) #define PRIX64 "I64X"

The format specifiers were added in 2002 and never changed since that time,
so they are rather old. They don't break any current mingw32 builds.
They will break builds as soon as mingw32 fixes the wrong definitions
(which I don't expect for the next months).

I'll send a patch which simply removes the definitions from
qemu-common.h, so Jan's patch is no longer needed.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] Avoid double definitions of PRI*64
  2011-06-24  6:11       ` Stefan Weil
@ 2011-06-24  6:12         ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-06-24  6:12 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-trivial, Jan Kiszka, qemu-devel

On Fri, Jun 24, 2011 at 7:11 AM, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 24.06.2011 07:41, schrieb Stefan Hajnoczi:
>>
>> On Thu, Jun 23, 2011 at 3:32 PM, Stefan Weil <weil@mail.berlios.de> wrote:
>>>
>>> Am 23.06.2011 15:35, schrieb Stefan Hajnoczi:
>>>>
>>>> On Thu, Jun 23, 2011 at 10:15:58AM +0200, Jan Kiszka wrote:
>>>>>
>>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>
>>>>> Recent mingw32 provide those defines.
>>>
>>> ... and all of those defines are wrong, because QEMU does not use
>>> MS format specifiers. http://patchwork.ozlabs.org/patch/74276/
>>> tried to fix this. My preferred solution is removing those PRI*64 from
>>> qemu-common.h, because not only recent mingw32 versions provide
>>> the (wrong) definitions, but even the Debian version provides them
>>> (which is really old, but I use it for my regression tests).
>>>
>>> The wrong definitions do not allow using -Wformat for mingw32
>>> builds, but they work because (most?) relevant mingw32 functions
>>> accept both MS and standard format specifiers.
>>>
>>> Adding the correct definitions (to qemu-os-win32.h, not to qemu-common.h)
>>> would be another solution as long as mingw32 does not handle
>>> __USE_MINGW_ANSI_STDIO correctly.
>>>
>>>>>
>>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>> ---
>>>>> qemu-common.h | 3 +++
>>>>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>>>
>>>> It's never too late to implement C99!
>>>>
>>>> Thanks, applied to the trivial patches tree:
>>>>
>>>> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches
>>>>
>>>> Stefan
>>>
>>> Stefan, the patch won't harm, but it's also unnecessary.
>>> So it's up to you whether you remove it from your queue,
>>> modify it as I suggested above or apply it as it is.
>>
>> Keeping those #defines unconditional prevents new mingw builds from
>> working, according to the commit description. So we have to either
>> remove them entirely or do them correctly. Dropping this patch will
>> keep the build from working.
>>
>> I suggest we keep this patch. A follow-up patch can us MS format
>> specifiers or do any other adjustments that make this work better.
>> Stefan, would you be able to send that patch?
>>
>> Stefan
>
> Hi Stefan,
>
> I just did a "git blame include/inttypes.h" on cygwin/mingw32 sources
> (git repository created from CVS). Here is the result:
>
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  34) #define PRId64 "I64d"
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  52) #define PRIi64 "I64i"
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  70) #define PRIo64 "I64o"
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000  90) #define PRIu64 "I64u"
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000 109) #define PRIx64 "I64x"
> 8f6754d5 (dannysmith 2002-06-13 10:20:41 +0000 127) #define PRIX64 "I64X"
>
> The format specifiers were added in 2002 and never changed since that time,
> so they are rather old. They don't break any current mingw32 builds.
> They will break builds as soon as mingw32 fixes the wrong definitions
> (which I don't expect for the next months).
>
> I'll send a patch which simply removes the definitions from
> qemu-common.h, so Jan's patch is no longer needed.

Thanks!

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-24  6:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23  8:15 [Qemu-devel] [PATCH] Avoid double definitions of PRI*64 Jan Kiszka
2011-06-23 13:35 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-06-23 14:32   ` Stefan Weil
2011-06-24  5:41     ` Stefan Hajnoczi
2011-06-24  6:11       ` Stefan Weil
2011-06-24  6:12         ` Stefan Hajnoczi

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