From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC0BJ-0005YE-7A for qemu-devel@nongnu.org; Wed, 12 Sep 2012 23:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TC0BH-0003jW-JH for qemu-devel@nongnu.org; Wed, 12 Sep 2012 23:33:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TC0BH-0003jS-AP for qemu-devel@nongnu.org; Wed, 12 Sep 2012 23:33:31 -0400 Message-ID: <50515406.8020203@redhat.com> Date: Wed, 12 Sep 2012 21:33:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1347265586-17698-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1347265586-17698-3-git-send-email-xiawenc@linux.vnet.ibm.com> <504FC0B1.7080903@redhat.com> <504FFC05.5070601@linux.vnet.ibm.com> <5050874B.4050505@redhat.com> <505151D8.9030300@linux.vnet.ibm.com> In-Reply-To: <505151D8.9030300@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigF79B7CD173A2248842419A9E" Subject: Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, Blue Swirl , pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF79B7CD173A2248842419A9E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/12/2012 09:24 PM, Wenchao Xia wrote: > =E4=BA=8E 2012-9-12 20:59, Eric Blake =E5=86=99=E9=81=93: >> On 09/11/2012 09:05 PM, Wenchao Xia wrote: >>>> Seriously? We require a C99-compliant compiler, which is required t= o >>>> treat the more compact version identically (all undefined names >>>> evaluate >>>> to 0 in the preprocessor), and HACKING doesn't mandate that we spell= >>>> out >>>> a defined-ness check first. Okay, so configure adds -Wundef to the = set >>>> of CFLAGS, but I fail to see why we want -Wundef (that's an >>>> anachronistic warning, only there to help you if you are writing cod= e >>>> portable to K&R). >>>> >>> So if the preprocessor replaced __GNUC__ to 0, is there difference= >>> between these two kinds of macoros? >>> #if __GNUC__ >=3D 4 >>> #if defined(__GNUC__) && __GNUC__ >=3D4 >> >> The only difference is whether -Wundef will warn, and I'm trying to >> argue that qemu's current use of -Wundef is pointless, as that warning= >> exists solely for K&R compatibility, not for modern standard-compliant= >> code correctness. >> > OK ,then I think > #if __GNUC__ >=3D 4 > .... > #else > [warn name space pollution may happen] > #endif > would be better. It may be shorter, but it is definitely not better, at least not in the current context of qemu. Using the short form will fail a -Werror build, unless you also write a patch to qemu's configure to quit supplying -Wundef during builds. But as touching configure has a bigger impact to the overall qemu project, you're going to need a lot more buy-in from other developers that -Wundef is not helping qemu gain any portability, and that it is safe to ditch it (or get enough counter-arguments from other developers why qemu insists on the anachronistic style enforced by -Wundef, at which point you must comply and use the longer form). --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigF79B7CD173A2248842419A9E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQUVQGAAoJEKeha0olJ0NqVA4H/iHpfNguZlz2RWC9QZsfotOr FpXIMxiUFBIuCp8+RaM36fSYNNswZ/sdeoJ69ZJBjM34w3WENNJtlSCo50UvZBkF h/vyO6uleiv1RoFaehn/59wzmw03VbTeuKnUSn0gZMBcwhIBACb+tAPl5UWetQLf BQaGZ0LXfRwgTqBtLA+TjGnmHF0mbPm+ohXP1d0K6gt+MLifsuYqIZ1SXQFMPrdT z93084NO7T14AdUFuzKEXFiMKuqju3duYSvxMeEU4Lku4iLZFfpUlf8KNcPstXbU HgIjOfxpvw/Yvv2RlnBZz+QeOOMUSbiT6DH5VAZi1JIbac3u/U94je/LEa0pKeU= =+UHz -----END PGP SIGNATURE----- --------------enigF79B7CD173A2248842419A9E--