Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bob Steagall <bob.steagall.cpp@gmail.com>
To: andrew.burgess@embecosm.com
Cc: gdb-patches@sourceware.org
Subject: Re: potential patch for gdb bug c++/20020
Date: Thu, 06 Dec 2018 20:49:00 -0000	[thread overview]
Message-ID: <CAOhs8xKJXH0fTNmdGQuybNT=VCUO4c4iJZix4EhTATzer997vw@mail.gmail.com> (raw)
In-Reply-To: <20181206192003.GZ18841@embecosm.com>

On Thu, Dec 6, 2018 at 2:20 PM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
>
> * Bob Steagall <bob.steagall.cpp@gmail.com> [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   <bob.steagall.cpp@gmail.com>
> >
> >         * 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,
> >                                       _("<error reading variable: %s>"),
> >                                       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


  reply	other threads:[~2018-12-06 20:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOhs8xKxGGTqpuFd40wWA8O6i97Odc_dmG=csK1DAFf=TCnYbg@mail.gmail.com>
2018-12-06 18:29 ` Bob Steagall
2018-12-06 19:20   ` Andrew Burgess
2018-12-06 20:49     ` Bob Steagall [this message]
2018-12-06 21:07       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOhs8xKJXH0fTNmdGQuybNT=VCUO4c4iJZix4EhTATzer997vw@mail.gmail.com' \
    --to=bob.steagall.cpp@gmail.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox