Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Enze Li via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Cc: enze.li@gmx.com
Subject: Re: [PATCH] gdb: add constructor to gdb_user_regs
Date: Mon, 08 Aug 2022 21:08:42 +0800	[thread overview]
Message-ID: <OS3P286MB21522DE8651F6BD145F2DCF4F0639@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <7fc69637-ecd5-01e5-0db1-32fb2117322f@suse.de>

Hi Tom,

On Mon, 2022-08-08 at 10:03 +0200, Tom de Vries wrote:
> > On 8/6/22 07:14, Enze Li via Gdb-patches wrote:
> > > > When building gdb with clang 14 and -std=gnu++11, I ran into:
> > > > 
> > > >    CXX    user-regs.o
> > > > user-regs.c:83:29: error: no matching constructor for> >
> > initialization of 'struct gdb_user_regs'
> > > > static struct gdb_user_regs builtin_user_regs = {
> > > >                              ^                   ~
> > > > user-regs.c:58:8: note: candidate constructor (the implicit
> > > > copy> >
> > constructor) not viable: requires 1 argument, but 2 were provided
> > > > struct gdb_user_regs
> > > >         ^
> > > > user-regs.c:58:8: note: candidate constructor (the implicit
> > > > move> >
> > constructor) not viable: requires 1 argument, but 2 were provided
> > > > user-regs.c:58:8: note: candidate constructor (the implicit
> > default> > constructor) not viable: requires 0 arguments, but 2
> > were
> > provided
> > > > 1 error generated.
> > > > 
> > > > The fundamental reason is that C++11 does not support this> >
> > approach.
> > > > This patch adds a constructor to gdb_user_regs to avoid the
> > > > build
> > > > failure.
> > > > 
> > 
> > Hi,
> > 
> > I ran into a similar problem with gcc 4.8 (I noticed a build
> > failure 
> > with centos @ builder.sourceware.org) and fixed it here ( 
> > https://sourceware.org/git/?p=binutils-
> gdb.git;a=commit;h=411c7e044fa99089d3030f2c61525c4d415f7b45 
> > ).
> > 
> > My apologies that I didn't notice your patch.

It's okay, mine is just a proposed one.
 
> > 
> > Anyway, I hope that this fixes the problem for you as well.  I've 
> > managed to do a build using clang-13.0.0 (with --disable-werror)
> > up>
> to 
> > the point of an AFAICT unrelated linker failure.
> > 
> > Thanks,
> > - Tom

With your patch applied, I have tested with clang 13, 14 and 15, and
they all built successfully.  Thanks for doing this.

Thanks,
Enze

> > 
> > > > Tested by rebuilding on x86_64-linux with clang 14 and gcc 12,
> > with> > and
> > > > without -std=gnu++11.
> > > > ---
> > > >   gdb/user-regs.c | 12 ++++++++++--
> > > >   1 file changed, 10 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/gdb/user-regs.c b/gdb/user-regs.c
> > > > index 4bc4685387f..a2012b84534 100644
> > > > --- a/gdb/user-regs.c
> > > > +++ b/gdb/user-regs.c
> > > > @@ -57,8 +57,16 @@ struct user_reg
> > > >   
> > > >   struct gdb_user_regs
> > > >   {
> > > > -  struct user_reg *first = nullptr;
> > > > -  struct user_reg **last = nullptr;
> > > > +  gdb_user_regs (struct user_reg *mfirst, struct user_reg
> > > > **mlast)
> > > > +    : first (mfirst),
> > > > +      last (mlast)
> > > > +  {
> > > > +  }
> > > > +
> > > > +  gdb_user_regs () = default;
> > > > +
> > > > +  struct user_reg *first;
> > > > +  struct user_reg **last;
> > > >   };
> > > >   
> > > >   static void

      reply	other threads:[~2022-08-08 13:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06  5:14 Enze Li via Gdb-patches
2022-08-08  8:03 ` Tom de Vries via Gdb-patches
2022-08-08 13:08   ` Enze Li via Gdb-patches [this message]

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=OS3P286MB21522DE8651F6BD145F2DCF4F0639@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=gdb-patches@sourceware.org \
    --cc=enze.li@gmx.com \
    --cc=enze.li@hotmail.com \
    --cc=tdevries@suse.de \
    /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