public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Enze Li <lienze2010@hotmail.com>, Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Add initializers to bound_minimal_symbol
Date: Wed, 16 Feb 2022 10:29:40 -0500	[thread overview]
Message-ID: <4248fa34-619d-5a35-4bd4-9c566407cc0d@polymtl.ca> (raw)
In-Reply-To: <MEAP282MB02938322FF90AADA96CFECC0DD359@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM>



On 2022-02-16 09:31, Enze Li wrote:
> Hi Tom,
> 
> I also encountered a similar error message when I compiled with clang.Then I found this thread that you are discussing. 
> 
> I use the following commands to build,
> $ ./configure --prefix=`pwd`/build CC=clang CXX=clang++ \
>   CXXFLAGS=-std=gnu++11 --disable-unit-tests
> 
> It says,
> =====================================================================
>   CXX    macroscope.o
> linespec.c:4276:31: error: no matching constructor for initialization
> of 'struct bound_minimal_symbol'
>   struct bound_minimal_symbol mo = {minsym, objfile};
>                               ^    ~~~~~~~~~~~~~~~~~
> ./minsyms.h:29:8: note: candidate constructor (the implicit copy
> constructor) not viable: requires 1 argument, but 2 were provided
> struct bound_minimal_symbol
>        ^
> ./minsyms.h:29:8: note: candidate constructor (the implicit move
> constructor) not viable: requires 1 argument, but 2 were provided
> ./minsyms.h:29:8: note: candidate constructor (the implicit default
> constructor) not viable: requires 0 arguments, but 2 were provided
> =====================================================================
> 
> On Tue, 2022-02-15 at 08:41 -0700, Tom Tromey via Gdb-patches wrote:
>> Simon> Hmm, I see this with g++-11:
>>
>> I'm also using gcc 11 and I don't see this error.
> 
> It seems that Simon is referring to the use of the C++11 standard.

I didn't mean to, but I think you are right.  This build of mine has
-std=c++11 in CXXFLAGS, which I added exactly to catch these issues
(since the recent compilers default to a more recent C++).

>> I wrote the appended and this also built fine.  But I don't know ifit
>> would work for you.
>>
>> Tom
> 
> With the appended patch, it built fine for me with clang.  And I also
> tested it with gcc-11 as Simon did and again there were no problems.
> 
> $ ./configure --prefix=`pwd`/build CXXFLAGS=-std=gnu++11 \
>   --disable-unit-tests
> 
> BTW, all tests were conducted on the latest openSUSE Tumbleweed.
> It has:
> - gcc (SUSE Linux) 11.2.1 20220103
> - clang version 13.0.1

LGTM too, thanks.

I would just suggest changing the call in add_minsym like so:

-  struct bound_minimal_symbol mo = {minsym, objfile};
-  msyms->push_back (mo);
+  msyms->emplace_back (minsym, objfile);

This just avoids constructing the object and then copying it.

Simon

  reply	other threads:[~2022-02-16 15:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 20:42 Tom Tromey
2022-02-11 13:34 ` Simon Marchi
2022-02-14 15:53   ` Simon Marchi
2022-02-15 15:41     ` Tom Tromey
2022-02-16 14:31       ` Enze Li
2022-02-16 15:29         ` Simon Marchi [this message]
2022-02-16 20:47           ` 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=4248fa34-619d-5a35-4bd4-9c566407cc0d@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=lienze2010@hotmail.com \
    --cc=tromey@adacore.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).