From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119010 invoked by alias); 6 Dec 2018 20:49:03 -0000 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 Received: (qmail 118702 invoked by uid 89); 6 Dec 2018 20:48:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=braces X-HELO: mail-io1-f54.google.com Received: from mail-io1-f54.google.com (HELO mail-io1-f54.google.com) (209.85.166.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Dec 2018 20:48:48 +0000 Received: by mail-io1-f54.google.com with SMTP id n9so1502155ioh.7 for ; Thu, 06 Dec 2018 12:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R6E03+oWbz7h6v6MEj3xBMYEde/hHXri5hu23UmVj4o=; b=rpdtmWxIVNlKloXsthP4tIAYAIBMBX/Or2+2cuRRm/1Y9cgDU4Nmad1s9v7ym+lqpl GwWU9332H54YZmrRXDAqAZnHR/h6YeRlRb2ow76h2G6mLGtnWUaZZXl8R9/zVbk1Sad+ NEOjJNrDdzYYoiR5H9XOAxPFywy0Ghk9nU6g5aDjISGtRjnaP4ASsbeAyN9jObIY2aa/ X/A8klQe9WlPO8O/5yqZx9Z5ad51NZkViKX6jl49YSE1W6m4EWYRwwHYKA55wQQvTJmk od1GWRNxIXCthtOjilnx/PgiDgwaWJBVGWi1t/iQAnnu3Kie4PQs/0K3yPFOdxBvSLCZ BvMw== MIME-Version: 1.0 References: <20181206192003.GZ18841@embecosm.com> In-Reply-To: <20181206192003.GZ18841@embecosm.com> From: Bob Steagall Date: Thu, 06 Dec 2018 20:49:00 -0000 Message-ID: Subject: Re: potential patch for gdb bug c++/20020 To: andrew.burgess@embecosm.com Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-12/txt/msg00078.txt.bz2 On Thu, Dec 6, 2018 at 2:20 PM Andrew Burgess wrote: > > * Bob Steagall [2018-12-06 13:29:31 -0500]: > > > Description: This patch, against released version 8.2, fixes the > > problem reported in gdb bug c++/20020, using the approach described in > > comment 1 of that report. > > > > Changelog entry: > > > > 2018-12-06 Bob Steagall > > > > * cp-valprint.c: Fixes bug c++/20020. > > > --- gdb/cp-valprint.c 2018-09-05 03:27:13.000000000 -0400 > > +++ gdb/cp-valprint.c.new 2018-12-06 13:01:06.819266165 -0500 > > @@ -326,12 +326,16 @@ cp_print_value_fields (struct type *type > > fprintf_filtered (stream, > > _(""), > > ex.message); > > + v = NULL; > > I don't think this NULL assignment should be needed. `v` starts as > NULL, and we only end in this block if `value_static_field` throws an > exception, which will be before `v` is assigned too. Agreed. I was being, perhaps, too paranoid here. > > } > > END_CATCH > > > > - cp_print_static_field (TYPE_FIELD_TYPE (type, i), > > - v, stream, recurse + 1, > > - options); > > + if (v != NULL) > > + { > > You should drop the '{' and '}' here for a single statement block. Disagree. The gdb coding standard document specifically calls out lines of code, not statements: "Any two or more lines in code should be wrapped in braces, even if they are comments, as they look like separate statements" > > + cp_print_static_field (TYPE_FIELD_TYPE (type, i), > > + v, stream, recurse + 1, > > + options); > > + } > > } > > else if (i == vptr_fieldno && type == vptr_basetype) > > { > > I'm not a maintainer so can't approve patches, but this seems sensible > to me. > > Thanks, > Andrew I will update and re-send. Thanks for the review, --Bob