public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PING][RFC][gdb] Fix build error in macroexp.c
Date: Tue, 03 Jul 2018 14:22:00 -0000	[thread overview]
Message-ID: <a972f2f2-4d9a-a4c1-4158-dec0806c2c8f@suse.de> (raw)
In-Reply-To: <20180622071433.nsoekb62ctcluwap@localhost.localdomain>

On 06/22/2018 09:14 AM, Tom de Vries wrote:
> Hi,
> 
> When doing a combined build with the gcc and binutils-gdb repos, I run into
> this build error in gdb:
> ...
> gdb/macroexp.c: \
>   In function ‘void get_next_token_for_substitution(macro_buffer*, \
>   macro_buffer*, char**, macro_buffer*, char**, int*, bool*)’:
> gdb/macroexp.c:925:17: error: \
>   implicitly-declared ‘constexpr macro_buffer& \
>   macro_buffer::operator=(const macro_buffer&)’ is deprecated \
>   [-Werror=deprecated-copy]
>        *token = *lookahead;
> ...
> 
> This patch fixes the build error by adding an explicit copy operator to the
> macro_buffer class.  I've added asserts to ensure that both the dest and src
> of the copy are shared, in other words, neither is owner of the text pointer.
> 
> I've run the gdb testsuite on x86_64-linux and the asserts did not trigger.
> 
> Any comments?
> 
> Thanks,
> - Tom
> 
> [gdb] Fix build error in macroexp.c
> 
> 2018-06-22  Tom de Vries  <tdevries@suse.de>
> 
> 	* macroexp.c (macro_buffer) <operator=>: New member function.
> 
> ---
>  gdb/macroexp.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/gdb/macroexp.c b/gdb/macroexp.c
> index 1fa37d2875..8b4dfb20b8 100644
> --- a/gdb/macroexp.c
> +++ b/gdb/macroexp.c
> @@ -112,6 +112,16 @@ struct macro_buffer
>      shared = true;
>    }
>  
> +  macro_buffer& operator=(const macro_buffer &src)
> +  {
> +    gdb_assert (src.shared);
> +    gdb_assert (shared);
> +    set_shared (src.text, src.len);
> +    last_token = src.last_token;
> +    is_identifier = src.is_identifier;
> +    return *this;
> +  }
> +
>    ~macro_buffer ()
>    {
>      if (! shared && size)
> 

  reply	other threads:[~2018-07-03 14:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22  7:14 [RFC][gdb] " Tom de Vries
2018-07-03 14:22 ` Tom de Vries [this message]
2018-07-04 15:51 ` Simon Marchi

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=a972f2f2-4d9a-a4c1-4158-dec0806c2c8f@suse.de \
    --to=tdevries@suse.de \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).