From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2279 invoked by alias); 8 Mar 2011 14:30:59 -0000 Received: (qmail 2247 invoked by uid 22791); 8 Mar 2011 14:30:57 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 14:30:45 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p28EUQ4n075055 ; Tue, 8 Mar 2011 15:30:26 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms8.u-strasbg.fr [130.79.204.17]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p28EUP3l032096 ; Tue, 8 Mar 2011 15:30:25 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p28EUOcT074579 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Tue, 8 Mar 2011 15:30:24 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" , "'Michael Snyder'" Cc: References: <4D6D58F2.8070207@vmware.com> <20110308051024.GL30306@adacore.com> In-Reply-To: <20110308051024.GL30306@adacore.com> Subject: RE: [RFA] p-typeprint.c, move pointer use to after null-check. Date: Tue, 08 Mar 2011 14:56:00 -0000 Message-ID: <004e01cbdd9d$5d383600$17a8a200$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00536.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: mardi 8 mars 2011 06:10 > =C0=A0: Michael Snyder > Cc=A0: gdb-patches@sourceware.org; Pierre Muller > Objet=A0: Re: [RFA] p-typeprint.c, move pointer use to after null-check. >=20 > > If it's worth checking for null... > > > > OK? > > >=20 > > 2011-03-01 Michael Snyder > > > > * p-typeprint.c (pascal_type_print_method_args): Don't use > > pointer until after null-check. > I think I get the drift of the code, and ISTM that the check for NULL > might be misleading. I think that "physname" can never be null, by > virtue of how it's called. What I would do is just remove the check > against NULL (we can add a gdb_assert at the same time, which would > force us to declare the is_constructor/is_destructor variables without > initial value - no big deal). >=20 > Pierre? No, I think that the code relies on the fact that physname is never null, but that the constructor or destructor could have no parameters, in which case physname would point to \0 after the '+=3D 6'. Parameterless pascal procedure/functions do not require opening/closing braces like C does. So I still think that the current code is correct. So to answer to Michael, with my apologies for the delay, I do think that your patch is not correct and should not be applied as is. =20 > A few remarks: >=20 > The function could (should?) be made static, unless I grep'ed wrong Should indeed... =20=20 =20 > > + if (is_constructor || is_destructor) > > + { > > + physname +=3D 6; > > + } >=20 > Useless extra curly braces... OK, while correcting these, I also saw that:=20=20 Is this correct: if (physname && (*physname !=3D 0)) or is: if (physname && *physname !=3D 0) better? or should I use: if (physname && *physname !=3D '\0') Pierre Muller GDB pascal language maintainer