From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48984 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OE2lV-0008LK-R9 for qemu-devel@nongnu.org; Mon, 17 May 2010 12:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OE2lL-0001FW-Sh for qemu-devel@nongnu.org; Mon, 17 May 2010 12:01:55 -0400 Received: from mail-px0-f173.google.com ([209.85.212.173]:50128) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OE2lH-0001Db-SO for qemu-devel@nongnu.org; Mon, 17 May 2010 12:01:51 -0400 Received: by pxi19 with SMTP id 19so2595746pxi.4 for ; Mon, 17 May 2010 09:01:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4BEF1489.6000907@mail.berlios.de> Date: Mon, 17 May 2010 19:01:44 +0300 Message-ID: Subject: Re: [Qemu-devel] [PATCH 0/3] mingw32 compile fixes From: Blue Swirl Content-Type: text/plain; charset=UTF-8 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel On 5/17/10, Markus Armbruster wrote: > Blue Swirl writes: > > > On 5/16/10, Stefan Weil wrote: > >> Am 15.05.2010 22:49, schrieb Blue Swirl: > >> > >> > >> > Hi, > >> > > >> > With this mingw32 compiler: > >> > > >> > $ i586-mingw32msvc-gcc -v > >> > Using built-in specs. > >> > Target: i586-mingw32msvc > >> > Configured with: > > [...] > > >> > build will not succeed because formats %zd, %zu, %hh, %lld, %llx and > >> > %llu are not known by the compiler. > >> > > >> > Any %ll* use is clearly a bug, we have PRI*64 macros just for this > >> purpose. > >> > > >> > For %hh and %z there may be better ways than these patches. > >> > > >> > With the patches I can build working Win32 binaries and there are no > >> warnings. > > [...] > > >> It's a compiler bug that the compiler does not know these format strings. > >> The code works nevertheless (at least with mingw libraries which are > >> not too old) because the format strings are interpreted by the C runtime > >> library. > >> > >> Is it worth changing a lot of files when we can expect a newer mingw > >> compiler version which works correctly for standard format strings? > > > > When and if that version becomes popular, PRIz* and the %hh hack could > > be removed or a compiler check could be added. But I don't think it's > > worth it, the macros are easy to use. > > > They're also ugly as sin. Avi's signature tells the reason, the macros are products of standards committees. But on second thought, perhaps it's not OK standard-wise to invent PRIz* macros, at least they should be prefixed with Q to avoid conflict. That probably does not improve the beauty of the macros. ;-) I also noticed the SCN* macros now. We are incorrectly using PRI* macros where SCN* should be used. Too bad this doesn't solve the %hh problem, SCNx8 is not defined on mingw32.