From patchwork Sat Dec 13 07:29:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 4230 Received: (qmail 7811 invoked by alias); 13 Dec 2014 07:30:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7777 invoked by uid 89); 13 Dec 2014 07:30:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 13 Dec 2014 07:30:26 +0000 Received: by mail-pa0-f46.google.com with SMTP id lf10so7971318pab.5 for ; Fri, 12 Dec 2014 23:30:25 -0800 (PST) X-Received: by 10.70.126.161 with SMTP id mz1mr33649998pdb.14.1418455824948; Fri, 12 Dec 2014 23:30:24 -0800 (PST) Received: from sspiff.org (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id jd1sm3358714pbd.49.2014.12.12.23.30.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Dec 2014 23:30:24 -0800 (PST) Received: by sspiff.org (sSMTP sendmail emulation); Fri, 12 Dec 2014 23:29:31 -0800 From: Doug Evans To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] value_maybe_namespace_elt: Remove unnecessary test of result != NULL. Date: Fri, 12 Dec 2014 23:29:31 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. I happened to notice this while reading the code, and then studied both allocate_value and value_of_variable. They are guaranteed to return non-NULL, so testing result != NULL is unnecessary. Regression tested on amd64-linux. 2014-12-12 Doug Evans * valops.c (value_maybe_namespace_elt): Remove unnecessary test of result != NULL. diff --git a/gdb/valops.c b/gdb/valops.c index 4125fc0..4d3059e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3586,7 +3586,7 @@ value_maybe_namespace_elt (const struct type *curtype, else result = value_of_variable (sym, get_selected_block (0)); - if (result && want_address) + if (want_address) result = value_addr (result); return result;