From patchwork Thu Sep 21 16:06:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23061 Received: (qmail 39585 invoked by alias); 21 Sep 2017 16:06:25 -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 39570 invoked by uid 89); 21 Sep 2017 16:06:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 16:06:24 +0000 Received: from CMOut01 (unknown [10.0.90.82]) by gproxy7.mail.unifiedlayer.com (Postfix) with ESMTP id C6E16215C8A for ; Thu, 21 Sep 2017 10:06:22 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id CG6K1w00R2f2jeq01G6Nsx; Thu, 21 Sep 2017 10:06:22 -0600 X-Authority-Analysis: v=2.2 cv=K4VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=0FD05c-RAAAA:8 a=1WE97YmpAcYXtF863bQA:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=l1rpMCqCXRGZwUSuRcM3:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:52652 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dv3zX-001Uw8-17; Thu, 21 Sep 2017 10:06:19 -0600 From: Tom Tromey To: Pedro Alves Cc: Simon Marchi , Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Remove make_cleanup_restore_target_terminal References: <20170920160404.20543-1-tom@tromey.com> <313985bd-111f-cea6-7b13-96217ee450cc@redhat.com> <87bmm5nhsw.fsf@tromey.com> <77e364fe-e0b9-de94-b6dd-ce759ee7400c@redhat.com> Date: Thu, 21 Sep 2017 10:06:18 -0600 In-Reply-To: <77e364fe-e0b9-de94-b6dd-ce759ee7400c@redhat.com> (Pedro Alves's message of "Thu, 21 Sep 2017 14:26:26 +0100") Message-ID: <87vakc6nph.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 X-BWhitelist: no X-Exim-ID: 1dv3zX-001Uw8-17 X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya) [75.166.76.94]:52652 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes 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 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 * utils.c (class scoped_input_handler) : Change type to scoped_restore_tmpl. : Initialize m_quit_handler directly. Reviewed-by: Pedro Alves 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 + + * utils.c (class scoped_input_handler) : Change + type to scoped_restore_tmpl. + : Initialize m_quit_handler directly. + 2017-09-21 Simon Marchi * 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 m_quit_handler; /* The saved UI, if non-NULL. */ struct ui *m_ui;