Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	 Tom Tromey <tom@tromey.com>,
	 gdb-patches@sourceware.org
Subject: Re: [RFA] Remove make_cleanup_restore_target_terminal
Date: Thu, 21 Sep 2017 16:06:00 -0000	[thread overview]
Message-ID: <87vakc6nph.fsf@tromey.com> (raw)
In-Reply-To: <77e364fe-e0b9-de94-b6dd-ce759ee7400c@redhat.com> (Pedro Alves's	message of "Thu, 21 Sep 2017 14:26:26 +0100")

Simon> Clang gives this warning, which seems valid to me:

Sorry about this.

Pedro> Indeed.  The field should be a scoped_restore_tmpl instead of
Pedro> a scoped_restore, and that mem-initializer above should be
Pedro> calling the scoped_restore_tmpl ctor instead of make_scoped_restore.

How's the appended?

Tom

commit c068483d29873c3bc80c8accc3f50cecae0f33d8
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Sep 21 09:54:25 2017 -0600

    Change type of scoped_input_handler::m_quit_handler
    
    Simon pointed out that scoped_input_handler::m_quit_handler must have
    the correct scoped_restore_tmpl type, to avoid binding to a temporary.
    This patch fixes the problem.
    
    gdb/ChangeLog
    2017-09-21  Tom Tromey  <tom@tromey.com>
    
            * utils.c (class scoped_input_handler) <m_quit_handler>: Change
            type to scoped_restore_tmpl.
            <scoped_input_handler>: Initialize m_quit_handler directly.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5803abf..429b8b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-21  Tom Tromey  <tom@tromey.com>
+
+	* utils.c (class scoped_input_handler) <m_quit_handler>: Change
+	type to scoped_restore_tmpl.
+	<scoped_input_handler>: Initialize m_quit_handler directly.
+
 2017-09-21  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* nat/linux-waitpid.c (linux_debug): Add ATTRIBUTE_PRINTF.
diff --git a/gdb/utils.c b/gdb/utils.c
index 9fea0f7..41ad35f 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -904,8 +904,7 @@ class scoped_input_handler
 public:
 
   scoped_input_handler ()
-    : m_quit_handler (make_scoped_restore (&quit_handler,
-					   default_quit_handler)),
+    : m_quit_handler (&quit_handler, default_quit_handler),
       m_ui (NULL)
   {
     target_terminal::ours ();
@@ -928,7 +927,7 @@ private:
   target_terminal::scoped_restore_terminal_state m_term_state;
 
   /* Save and restore the quit handler.  */
-  scoped_restore m_quit_handler;
+  scoped_restore_tmpl<quit_handler_ftype *> m_quit_handler;
 
   /* The saved UI, if non-NULL.  */
   struct ui *m_ui;


  reply	other threads:[~2017-09-21 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 16:04 Tom Tromey
2017-09-20 16:21 ` Pedro Alves
2017-09-20 22:09   ` Tom Tromey
2017-09-21 13:16     ` Simon Marchi
2017-09-21 13:26       ` Pedro Alves
2017-09-21 16:06         ` Tom Tromey [this message]
2017-09-22 15:47           ` 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=87vakc6nph.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@polymtl.ca \
    /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