Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MUoNX-0004vu-RO for mharc-grub-devel@gnu.org; Sat, 25 Jul 2009 17:02:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MUoNW-0004te-5S for grub-devel@gnu.org; Sat, 25 Jul 2009 17:02:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MUoNR-0004ng-Cs for grub-devel@gnu.org; Sat, 25 Jul 2009 17:02:01 -0400 Received: from [199.232.76.173] (port=35967 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUoNR-0004nR-1O for grub-devel@gnu.org; Sat, 25 Jul 2009 17:01:57 -0400 Received: from mail-ew0-f228.google.com ([209.85.219.228]:42872) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MUoNQ-0004oY-Cb for grub-devel@gnu.org; Sat, 25 Jul 2009 17:01:56 -0400 Received: by ewy28 with SMTP id 28so1647551ewy.42 for ; Sat, 25 Jul 2009 14:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer; bh=kkUNoEGqovsgddvsn8I2WktZSfmJMDXtA0UD3CbZ2Mk=; b=Z0e2jFPszUNiidhjPFqJ989xq78fyHVkjN10PBFGwBZwfPJa/ZpDQVf8tBfEjGf89V rqx+Z/OhLouFRYdiuWX2tnGjc7wHgmyRVQb3IBlbCzljNZNxKNbvZhSamH1yieQmKrl9 6UXMCbXi9slL3YXHoEhVhbTnOuXbgqqxXELfY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer; b=kOdSNFfK6ciGyjGgx/2qWmiFNkM/VQR2zlYdEbJB2Eku2myli0do3Zy4yDO7r2zBIR 2f6J57OgE1f3pyTDuSIzlgbrX8ImLvufev9MwfS6zym6RwSeW/bAP2r4g/PNa1dZ/nVQ /FopcyvUGuVV0mfQyaeyujy0MY3Yq71WUkXcM= Received: by 10.210.131.6 with SMTP id e6mr6122502ebd.63.1248555715720; Sat, 25 Jul 2009 14:01:55 -0700 (PDT) Received: from ?192.168.1.100? (89.141.11.145.dyn.user.ono.com [89.141.11.145]) by mx.google.com with ESMTPS id 5sm2102622eyf.4.2009.07.25.14.01.54 (version=SSLv3 cipher=RC4-MD5); Sat, 25 Jul 2009 14:01:55 -0700 (PDT) From: Javier =?ISO-8859-1?Q?Mart=EDn?= To: The development of GRUB 2 In-Reply-To: <1248382669.2661.93.camel@mj> References: <1248347411.4660.81.camel@accesodirecto.casa> <1248359851.7855.2.camel@mj> <1248363011.4660.157.camel@accesodirecto.casa> <1248372662.4660.161.camel@accesodirecto.casa> <1248378660.2661.54.camel@mj> <1248382669.2661.93.camel@mj> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-G1SnI6289jwTSk5Zvkax" Date: Sat, 25 Jul 2009 23:02:07 +0200 Message-Id: <1248555727.4660.227.camel@accesodirecto.casa> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Check for the appropriate condition in types.h X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2009 21:02:02 -0000 --=-G1SnI6289jwTSk5Zvkax Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable El jue, 23-07-2009 a las 16:57 -0400, Pavel Roskin escribi=C3=B3: > On Thu, 2009-07-23 at 22:30 +0200, Vladimir 'phcoder' Serbinenko wrote: > > >> > [GRUB_CPU_SIZEOF_VOID_P =3D=3D 8]: Changed to ... > > >> > [GRUB_CPU_SIZEOF_LONG =3D=3D 8]: ... this. > > >> Ok, let's adopt this form instead. The proposed ChangeLog would now = be: > > > > > > >From the GNU Coding Standards: > > > > > > "C programs often contain compile-time `#if' conditionals. Many chan= ges > > > are conditional; sometimes you add a new definition which is entirely > > > contained in a conditional. It is very useful to indicate in the > > > change log the conditions for which the change applies. Our conventi= on > > > for indicating conditional changes is to use square brackets around t= he > > > name of the condition." > > > > > > It means that the square brackets are used if the changes only affect > > > the code under the condition specified in brackets. This is not what= is > > > happening here. > > > > > This is exactly what happens here: we change only what happens in > > conditionals [GRUB_CPU_SIZEOF_VOID_P =3D=3D 8] and [GRUB_CPU_SIZEOF_LON= G > > =3D=3D 8] >=20 > I'm not interested to discuss the right interpretation of the coding > standards. >=20 > Frankly, I'm not a fan of keeping ChangeLog, as it's too formal and it's > a point of contention for parallel development. I prefer the Linux > kernel style of descriptions. >=20 > But since we are updating ChangeLog, let's keep it readable. So, how would this precise change be specified? I don't mean to seem anxious, but I wouldn't want such a simple patch to be ensnared by what I personally consider a Byzantine argument. I propose the following wording, but we need someone more familiar with the FSF "bureaucracy" to review it: O Robert, we summon Thou ;) 2009-07-26 Javier Martin * include/grub/types.h (GRUB_CPU_SIZEOF_VOID_P =3D=3D 8): Change... (GRUB_CPU_SIZEOF_LONG =3D=3D 8) ... into this where appropriate (UINT_TO_PTR): move outside wordsize conditionals (PTR_TO_UINT): new macro >=20 > > >> (UINT_TO_PTR): move outside wordsize conditionals > > >> (PTR_TO_UINT): new macro > > > > > > We should remove PTR_TO_UINT32 and PTR_TO_UINT64 with PTR_TO_UINT > > > everywhere. I've checked that it doesn't introduce any warnings on a= ny > > > platform. > > > > > Sometimes PTR_TOUINT32 with precision loss is exactly what the coder > > wants. A typical example is booting 32-bit OS on 64-bit platform. This > > is the case of booting linux on efi64. Then the code has to ensure > > that the target is below 4GiB (see my mm propositions for more on how > > to ensure it). But I'm ok with requirement of additional explicit cast > > in such cases as > > (grub_uint32_t) PTR_TO_UINT (x) >=20 > That would be much better that PTR_TO_UINT32, as it makes the cast > explicit in the code that should ensure that the cast is valid. >=20 > We can find such cases by compiling with -Wconversion and finding the > newly appearing warnings after PTR_TO_UINT32 and PTR_TO_UINT64 are > replaced with PTR_TO_UINT. >=20 I also agree that PTR_TO_UINTnn should not exist: the eventual precision loss should be shown in the actual source using/abusing it. After this patch is merged, I could send in another one replacing all occurrences of those two macros by PTR_TO_UINT with the right casts. --=20 -- Lazy, Oblivious, Recurrent Disaster -- Habbit --=-G1SnI6289jwTSk5Zvkax Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Esto es una parte de mensaje firmado digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQIcBAABAgAGBQJKa3LLAAoJEKSl+Fbdeo721xAP/1472q/WYibKmSkwB50z++/L 3H37tvFzflpWklfh0YxMKRq2EhvW0WAcrfBMziV8FWwpZKly92RrZqFCWTSyUiCK 4EK9vDKQJTPZyX12sIdEeJVy+Q/Y3kTuQpcpg6z3goBFr0FxvPwpG8Ty6LZ0aTNx Tt+tSQlOIZfb2oxTUvslZocLUNAUWFTd7uEqANdKU8NGTCXJP6NncJ4o2nvbCgwB iBJMKsJm4VMDrlUTsVt1H+UR/FxZlT9bgUyrIr5xkAa0S9QmL7KjYjno5mrCEKRG VmE+PWwSDhc9+CsJDIPP6ILYlzeNTUk6BKhKk3l7Y3OgrQ55H+g60zW8fB2gk0Zt 1sJaQ3cQJGRDYjTxXDM8WMhMia8yjyPQzN1P0RdXyVN0sNUtXM9hzvTW9KgudWVG 07whoFsBpoGLcDthtSV3C/lb47fwh8qG1586o3F6f3YyKZMfUqd/lAaNZIp6sjue QiasDxiRpMHvYw8fTbv6rBl0jzfq2v/lDUcIl6e/1KhezTPWdBVJVy1UlE0TK3Z7 Fr7QhBorbmWgINm9CHHiN670WtFXiNa9oDQ71zFG48470aNIrNwhthacMoNufl9u 75ljYppaVRrIp/bBCa4H9F3POckeGZ4ks1mBBxvSA2HAhyFDe1fwQefz0t0ckjH+ TnxtI/7U/8hon4dXUZ7a =Absj -----END PGP SIGNATURE----- --=-G1SnI6289jwTSk5Zvkax--