From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yt0Uz-0006F6-Hj for qemu-devel@nongnu.org; Thu, 14 May 2015 17:16:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yt0Uw-0003hN-0q for qemu-devel@nongnu.org; Thu, 14 May 2015 17:16:57 -0400 Message-ID: <555510C2.7020507@redhat.com> Date: Thu, 14 May 2015 15:16:50 -0600 From: Eric Blake MIME-Version: 1.0 References: <1431635892-31996-1-git-send-email-sw@weilnetz.de> <55550E54.2080405@redhat.com> In-Reply-To: <55550E54.2080405@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nwsEgIUforXd8RFk80fu97hfgeFfbXdcD" Subject: Re: [Qemu-devel] [PATCH] pci: Fix compiler warning (MinGW-w64 gcc 4.9) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , QEMU Trivial Cc: QEMU Developer This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nwsEgIUforXd8RFk80fu97hfgeFfbXdcD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/14/2015 03:06 PM, Eric Blake wrote: > On 05/14/2015 02:38 PM, Stefan Weil wrote: >> i686-w64-mingw32-gcc 4.9.1 from Debian Jessie complains: >> >> hw/pci/pci.c:938:29: warning: >> array subscript is above array bounds [-Warray-bounds] >> >> Using g_assert instead of assert fixes this warning. >=20 > Is that because the mingw headers don't properly mark the expansion of > the failed branch of assert() as noreturn, whereas g_assert() does, and= > therefore the compiler has more information about what variables must b= e > if the rest of the function is reached? >=20 >=20 > Meanwhile, you may want to file a bug to the mingw maintainers that > their header is puny when compared to glibc assert() or to glib's > g_assert, when it comes to giving gcc decent hints. Oh, I was right! glibc /usr/include/assert.h: extern void __assert_fail (const char *__assertion, const char *__file, unsigned int __line, const char *__function) __THROW __attribute__ ((__noreturn__)); # define assert(expr) \= ((expr) \= ? __ASSERT_VOID_CAST (0) \= : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION= )) vs mingw /usr/i686-w64-mingw32/sys-root/mingw/include/assert.h: extern void __cdecl _assert (const char *_Message, const char *_File, unsigned _Line); #define assert(_Expression) \ (void) \ ((!!(_Expression)) || \ (_assert(#_Expression,__FILE__,__LINE__),0)) even though mingw has in that same file: void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; so it is indeed a bug in the mingw headers that __MINGW_ATTRIB_NORETURN was not attached to _assert's declaration. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nwsEgIUforXd8RFk80fu97hfgeFfbXdcD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVVRDDAAoJEKeha0olJ0NqpIoH/AvnCZv9aS2Qfj3k2FVjeN10 RSPcM6cohY9LgeH8rUi5MUvGwxbYm5d6tSuFaFGYirUkXZ16mUAG7xlpmc+dG9a1 p43dGiW6nxBTGxWzLtck/JYlBmsGIL0KCTDVtkyOpG2AgL/Prn4pAtjzUYEa+2f+ M6n7V7qwypugoSVYG/SiH4d8COz3qdQVFeIW/D9XyF5OaBeiz052cXNGyOBUy/Ib bBUjA8xirb2RCWHsyLvyr+3cdK+sf4a2EEb5TVAJHN5kbvx1Hic258VK+nHXlP90 ibdH28GXHIVIz8dObs5I20ylbMilzWUXm1DdeecsyRpbxAGZgoIaMi+AGGUBtLE= =YyYR -----END PGP SIGNATURE----- --nwsEgIUforXd8RFk80fu97hfgeFfbXdcD--