From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 9C682385840C for ; Fri, 28 Jan 2022 14:25:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C682385840C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 20SEP1ut007865 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Jan 2022 09:25:06 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 20SEP1ut007865 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B1C1C1EDF0; Fri, 28 Jan 2022 09:25:01 -0500 (EST) Message-ID: <4aa938bd-1d99-b6fe-d3d7-c1de42057d07@polymtl.ca> Date: Fri, 28 Jan 2022 09:25:01 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] gdb/build: Fix Wpessimizing-move in clang build Content-Language: en-US To: Enze Li , gdb-patches@sourceware.org References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 28 Jan 2022 14:25:01 +0000 X-Spam-Status: No, score=-3039.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 28 Jan 2022 14:25:13 -0000 On 2022-01-28 08:41, Enze Li via Gdb-patches wrote: > When building with clang, I run into an error: > > ... > tui/tui-disasm.c:138:25: error: moving a temporary object prevents copy > elision [-Werror,-Wpessimizing-move] > tal.addr_string = std::move (gdb_dis_out.release ()); > ^ > tui/tui-disasm.c:138:25: note: remove std::move call here > tal.addr_string = std::move (gdb_dis_out.release ()); > ^~~~~~~~~~~ ~ > ... > > The error above is caused by the recent commit 5d10a2041eb8 ("gdb: add > string_file::release method"). > > Fix this by removing std::move. > > Build on x86_64-linux with clang 13.0.0. > --- > gdb/tui/tui-disasm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c > index 445503a5af9..70f7429d32b 100644 > --- a/gdb/tui/tui-disasm.c > +++ b/gdb/tui/tui-disasm.c > @@ -135,7 +135,7 @@ tui_disassemble (struct gdbarch *gdbarch, > /* And capture the address the instruction is at. */ > tal.addr = orig_pc; > print_address (gdbarch, orig_pc, &gdb_dis_out); > - tal.addr_string = std::move (gdb_dis_out.release ()); > + tal.addr_string = gdb_dis_out.release (); > > if (addr_size != nullptr) > { Oh, thanks! In fact, this is the spot that did prompt me to add this release method, so it's a silly oversight on my part to not remove the std::move. Thanks patch is ok. Do you have push access? Simon