From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8261 invoked by alias); 8 Mar 2011 05:10:56 -0000 Received: (qmail 8250 invoked by uid 22791); 8 Mar 2011 05:10:55 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 05:10:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BA1FA2BAF95; Tue, 8 Mar 2011 00:10:49 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4kVFoWfjreEn; Tue, 8 Mar 2011 00:10:49 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 333042BAF2C; Tue, 8 Mar 2011 00:10:49 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id B8BF61459AD; Tue, 8 Mar 2011 09:10:24 +0400 (RET) Date: Tue, 08 Mar 2011 06:54:00 -0000 From: Joel Brobecker To: Michael Snyder Cc: "gdb-patches@sourceware.org" , Pierre Muller Subject: Re: [RFA] p-typeprint.c, move pointer use to after null-check. Message-ID: <20110308051024.GL30306@adacore.com> References: <4D6D58F2.8070207@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D6D58F2.8070207@vmware.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00518.txt.bz2 > If it's worth checking for null... > > OK? > > 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). Pierre? A few remarks: The function could (should?) be made static, unless I grep'ed wrong > + if (is_constructor || is_destructor) > + { > + physname += 6; > + } Useless extra curly braces... -- Joel