From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 124BA3858287 for ; Mon, 8 Aug 2022 08:03:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 124BA3858287 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 99C6F34FA2; Mon, 8 Aug 2022 08:03:47 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 74E4013A7C; Mon, 8 Aug 2022 08:03:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +sJyGmPD8GJTRQAAMHmgww (envelope-from ); Mon, 08 Aug 2022 08:03:47 +0000 Message-ID: <7fc69637-ecd5-01e5-0db1-32fb2117322f@suse.de> Date: Mon, 8 Aug 2022 10:03:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] gdb: add constructor to gdb_user_regs Content-Language: en-US To: Enze Li , gdb-patches@sourceware.org Cc: enze.li@gmx.com References: From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2022 08:03:51 -0000 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. 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 > 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