From patchwork Thu Jan 24 18:09:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 31206 Received: (qmail 101823 invoked by alias); 24 Jan 2019 18:09:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 101814 invoked by uid 89); 24 Jan 2019 18:09:37 -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_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Jan 2019 18:09:35 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 654017FD4A; Thu, 24 Jan 2019 18:09:34 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E74A926366; Thu, 24 Jan 2019 18:09:31 +0000 (UTC) Subject: [pushed] Fix clang/libc++ build (Re: [PATCH v3 06/17] Replace delete_longjmp_breakpoint_cleanup with a forward_scope_exit type) To: John Baldwin , "Pavel I. Kryukov" , gdb-patches@sourceware.org References: Cc: tom@tromey.com, andrew.burgess@embecosm.com From: Pedro Alves Message-ID: Date: Thu, 24 Jan 2019 18:09:30 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: On 01/24/2019 05:33 PM, John Baldwin wrote: > I got the same failure on FreeBSD (also uses libc++) and this patch fixed > the build for me. In that case, I've merged the patch in, as below. Thanks, Pedro Alves From 3046d67a0e29686ec18abd719660969c97973063 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 24 Jan 2019 18:01:49 +0000 Subject: [PATCH] Fix clang/libc++ build This fixes the following build error with clang/libc++, reported at : (...) In file included from breakpoint.c:34: In file included from ./inferior.h:54: ./common/forward-scope-exit.h:98:7: error: no matching constructor for initialization of 'decltype(std::bind(&delete_longjmp_breakpoint, std::declval()))' (aka '__bind') : m_bind_function (std::bind (function, args...)) ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./common/gdb_optional.h:155:19: note: in instantiation of member function 'detail::forward_scope_exit::forward_scope_exit' requested here new (&m_item) T (std::forward(args)...); ^ breakpoint.c:11127:18: note: in instantiation of function template specialization 'gdb::optional >::emplace' requested here lj_deleter.emplace (thread); ^ /Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:2220:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '__bind<[...], int &>' to 'const __bind<[...], int>' for 1st argument class __bind ^ (...) I don't really know why I ended up with a copy here. We can just pass the arguments directly to the being-constructed bind. gdb/ChangeLog: 2019-01-24 Pedro Alves * common/forward-scope-exit.h (forward_scope_exit::forward_scope_exit): Pass arguments to m_bind_function directly, instead of creating a std::bind and copying that. --- gdb/ChangeLog | 7 +++++++ gdb/common/forward-scope-exit.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 453677e599..e8e01288d9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-01-24 Pedro Alves + + * common/forward-scope-exit.h + (forward_scope_exit::forward_scope_exit): Pass arguments to + m_bind_function directly, instead of creating a std::bind and + copying that. + 2019-01-24 Alan Hayward * aarch64-tdep.c (aapcs_is_vfp_call_or_return_candidate_1): Check diff --git a/gdb/common/forward-scope-exit.h b/gdb/common/forward-scope-exit.h index 8d639151a4..bffc6e683b 100644 --- a/gdb/common/forward-scope-exit.h +++ b/gdb/common/forward-scope-exit.h @@ -95,7 +95,7 @@ class forward_scope_exit public: explicit forward_scope_exit (Args ...args) - : m_bind_function (std::bind (function, args...)) + : m_bind_function (function, args...) { /* Nothing. */ }