From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 9CA823858D33 for ; Tue, 8 Aug 2023 05:37:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9CA823858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4RKhmB3RRSz4ZXB; Tue, 8 Aug 2023 05:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RKhmB2bPgz3Xlr; Tue, 8 Aug 2023 05:37:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691473066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=90ZPGk5raxaAAURxLArBY9MGN3YaLOmgJQUks0rW7I0=; b=mjRDDrZeDsPOoBLzcJuajIGHpRUQR1cT8jh2pRQXcR/t9xfoDVjDVFopd6oB7hZy8elD6h ikem7tArUwj2QwahsxScawQlP3Gcsiz5H1KkD3AmzbUPCVhkW5UXNXgTXx5IYJDbm6gTDG RsFjsm4K/nSOBsDpsSj0pEvlasxUtYyYtohY6TXJXhgqaXbcqbx5YcV86JkTfFPYV2jTLH WIjCG16pxR99C5Jk+cobArir5yvJTcklh7Ki2qylOzYX+CJqZmizlijix5/zXM8QH4X4Kp h6RXs+sfiY9uSVzhVu+1TFgKjR+PbbJAYeu2Cqu5aBzD3De2DzrEqkbZCeXNZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691473066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=90ZPGk5raxaAAURxLArBY9MGN3YaLOmgJQUks0rW7I0=; b=n9g7H9P4gBvNkECS/lD6xMFiREyJkOzsvO0UgK4KXSGWYcjZ0nENAlr98Mr5GcK8OVNy5l A7bajrbMR+PokRgkVBuWu8LJc1NVbOBBjE7ljmDHLRHOiv44SM99e9S45RA4Vd5Pt68Jh6 xcfidLyVlKoLXYFxFxHB6DLcWPbvi589ZgwGVPYu2BrIr27K7zQmeNGmG7Dn0DlaCzulLc N0eCPMpi8JA83LhQ2vQUAQHvlRbwLoShRIdfGFprXa0BbqYtdpZd8+msp4me7mC5bs4Ic/ o5n4LXZa2na7K8QOCFrAr98cCRtxtl07vYko3CYODJFzJomk4F7s9dKXzcdmeQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691473066; a=rsa-sha256; cv=none; b=ynCHYoJMLAKCDviWPfhK0M9N7G9F2g6spDS0tw6VBZnYj9z+5GbbRci3OEPTg72lcuF+Q7 PKFrE6T5OsIW6D/AENyV7M8rN+mAc+Mewt25WMoEGWIV1gFLF006MnERisWZp1K5tXYDbx LhMBLOPaZpn5l+sHEiRFXRAeHtXPCc3YZLcOSR46EYHsQYhSv88aELak+P+X1oR0zvqAtd 1W5G5EJehTRXhH+Exx6+/e8IqmCWZLaAfv4vuKsBA/K/5RsQEEO0aNebOdimoYwkBq+pyJ 7WdWEpcqXwrs4M6G3+9gH8NTmy4O1sq7+QXFGp3fCfC8rdnhfDX1baoxjH7JQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [IPV6:2601:648:8683:a9e0:78da:f71f:8267:93ba] (unknown [IPv6:2601:648:8683:a9e0:78da:f71f:8267:93ba]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4RKhm95Mcrz1S5R; Tue, 8 Aug 2023 05:37:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Mon, 7 Aug 2023 22:37:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] [gdb/build] Fix build breaker with -std=c++11 Content-Language: en-US To: Tom de Vries , Simon Marchi , Tom de Vries via Gdb-patches Cc: Tom Tromey References: <20230806235915.18746-1-tdevries@suse.de> <51561E9D-24F0-48CB-A563-50F29C2966D9@polymtl.ca> <6682f2e5-f6ab-7b54-ba95-a60c217b6c86@suse.de> <21fba7d9-3f98-9ecd-2eb6-b574c23fd5db@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 8/7/23 4:11 PM, Tom de Vries wrote: > On 8/7/23 20:01, John Baldwin wrote: >> On 8/7/23 10:15 AM, Tom de Vries via Gdb-patches wrote: >>> On 8/7/23 16:35, Simon Marchi wrote: >>>> >>>> >>>> On August 6, 2023 7:59:15 p.m. EDT, Tom de Vries via Gdb-patches >>>> wrote: >>>>> When building with -std=c++11 I run into: >>>>> ... >>>>> gdb/dwarf2/cooked-index.c: In member function \ >>>>>    ‘void cooked_index::start_writing_index(dwarf2_per_bfd*)’: >>>>> gdb/dwarf2/cooked-index.c:469:10: error: lambda capture initializers >>>>> only \ >>>>>    available with -std=c++14 or -std=gnu++14 [-Werror] >>>>>            ctx = std::move (ctx)] () >>>>>            ^~~ >>>>> ... >>>>> >>>>> Fix this by capturing a copy instead: >>>>> ... >>>>>      = gdb::thread_pool::g_thread_pool->post_task ([this, per_bfd, >>>>> ctx] () >>>>> ... >>>>> >>>>> Tested on x86_64-linux. >>>>> >>>>> Reported-By: Tom Tromey >>>> >>>> When we encounter things like this, should we add some greppable TODO >>>> comment to record an actionable item for when we switch to a more >>>> recent C++ version? >>> >>> Hi Simon, >>> >>> thanks for the review. >>> >>> Fine by me, added comment. >> >> An alternative that is slightly more work but might be nicer long term >> would be >> to #if on the C++ version, so for example: >> >> #if __cplusplus >= 201402L >>   = gdb::thread_pool::g_thread_pool->post_task ([this, per_bfd, >>                                                 ctx = std::move (ctx)] () >> #else >>   = gdb::thread_pool::g_thread_pool->post_task ([this, per_bfd, ctx]) () >> #endif >> > > Thanks for the suggestion. Updated patch attached. LGTM Reviewed-by: John Baldwin -- John Baldwin