From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id tCSfCHvD8GJZrCIAWB0awg (envelope-from ) for ; Mon, 08 Aug 2022 04:04:11 -0400 Received: by simark.ca (Postfix, from userid 112) id 16A851E797; Mon, 8 Aug 2022 04:04:11 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Qie54G/H; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B3C6E1E797 for ; Mon, 8 Aug 2022 04:04:10 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B3D5D385802B for ; Mon, 8 Aug 2022 08:04:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3D5D385802B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659945849; bh=/IxJMmWq7RiWA8R+JUvKl67i4+Zs8rVPsUqLErI9KFw=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Qie54G/HqPfS+z9h0pnXBRngqKJIVqgOkOotC4vBnNUwBD46beNfLl9B+yRPBun9k BSNFGNT7oxW907X8/SQXQ5MrAcWcF0PRmu7tn/YEryYm+1X5rir0aj8XM5UuERHQBT hxypyzRmFRUlCf7O2ivu0TlDKvOehdOGW6dT7QSo= 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 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: enze.li@gmx.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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