From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121194 invoked by alias); 3 Jul 2018 14:22:44 -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 121164 invoked by uid 89); 3 Jul 2018 14:22:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1657, HContent-Transfer-Encoding:8bit X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Jul 2018 14:22:38 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5679EB054 for ; Tue, 3 Jul 2018 14:22:36 +0000 (UTC) Subject: [PING][RFC][gdb] Fix build error in macroexp.c From: Tom de Vries To: gdb-patches@sourceware.org References: <20180622071433.nsoekb62ctcluwap@localhost.localdomain> Message-ID: Date: Tue, 03 Jul 2018 14:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180622071433.nsoekb62ctcluwap@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00049.txt.bz2 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 > > * macroexp.c (macro_buffer) : 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) >