Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Pavel I. Kryukov" <kryukov@frtk.ru>, gdb-patches@sourceware.org
Cc: tom@tromey.com, andrew.burgess@embecosm.com
Subject: Re: [PATCH v3 06/17] Replace delete_longjmp_breakpoint_cleanup with a forward_scope_exit type
Date: Thu, 24 Jan 2019 17:09:00 -0000	[thread overview]
Message-ID: <ea6e1dea-8492-1c4c-e0ab-111767d12f24@redhat.com> (raw)
In-Reply-To: <CADip9gaDkswRP80cSQc1Bx=is8WERdXJuKpcD-F_8hqY5GT7wA@mail.gmail.com>

On 01/24/2019 11:23 AM, Pavel I. Kryukov wrote:
> The patch causes build errors on XCode:
> 
> $ clang --version
> Apple LLVM version 10.0.0 (clang-1000.11.45.5)
> Target: x86_64-apple-darwin17.7.0
> Thread model: posix
> InstalledDir: /Applications/Xcode10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Thanks.

Hmm, I only have clang 5.0.2 handy, and I think it links with
libstdc++ instead of clang's own libc++.  Here it builds fine.
I had also made sure the patch builds fine with g++ 4.8.

> 
> 
> 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<int>()))' (aka '__bind<void (*)(int), int>')
>     : m_bind_function (std::bind (function, args...))
>       ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./common/gdb_optional.h:155:19: note: in instantiation of member
> function 'detail::forward_scope_exit<void (int),
> &delete_longjmp_breakpoint, void (int)>::forward_scope_exit' requested
> here
>     new (&m_item) T (std::forward<Args>(args)...);
>                   ^
> breakpoint.c:11127:18: note: in instantiation of function template
> specialization 'gdb::optional<detail::forward_scope_exit<void (int),
> &delete_longjmp_breakpoint, void (int)> >::emplace<int &>' 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
>       ^

Hmm, references to the copy ctor.  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.  Does this work for you?

From b1caeb9c5334a59680af7b7717ab620e5a912bcf Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Thu, 24 Jan 2019 16:25:44 +0000
Subject: [PATCH] No copy ctor

---
 gdb/common/forward-scope-exit.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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<Function, function, Res (Args...)>
 
 public:
   explicit forward_scope_exit (Args ...args)
-    : m_bind_function (std::bind (function, args...))
+    : m_bind_function (function, args...)
   {
     /* Nothing.  */
   }
-- 
2.14.4


  reply	other threads:[~2019-01-24 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 11:23 Pavel I. Kryukov
2019-01-24 17:09 ` Pedro Alves [this message]
2019-01-24 17:35   ` John Baldwin
2019-01-24 18:09     ` [pushed] Fix clang/libc++ build (Re: [PATCH v3 06/17] Replace delete_longjmp_breakpoint_cleanup with a forward_scope_exit type) Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2019-01-23 15:21 [PATCH v3 00/17] Remove some cleanups using scope_exit Pedro Alves
2019-01-23 15:21 ` [PATCH v3 06/17] Replace delete_longjmp_breakpoint_cleanup with a forward_scope_exit type Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea6e1dea-8492-1c4c-e0ab-111767d12f24@redhat.com \
    --to=palves@redhat.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kryukov@frtk.ru \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox