From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 884 invoked by alias); 31 Jul 2017 22:17:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 872 invoked by uid 89); 31 Jul 2017 22:17:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: gproxy10-pub.mail.unifiedlayer.com Received: from gproxy10-pub.mail.unifiedlayer.com (HELO gproxy10-pub.mail.unifiedlayer.com) (69.89.20.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Jul 2017 22:17:24 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy10.mail.unifiedlayer.com (Postfix) with ESMTP id 81F4A14085F for ; Mon, 31 Jul 2017 16:17:23 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id raHL1v00c2f2jeq01aHPKt; Mon, 31 Jul 2017 16:17:23 -0600 X-Authority-Analysis: v=2.2 cv=epiv9shX c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=G3gG6ho9WtcA:10 a=0FD05c-RAAAA:8 a=5wPIF7rAxH7zsL5n74EA:9 a=l1rpMCqCXRGZwUSuRcM3:22 Received: from 174-29-39-24.hlrn.qwest.net ([174.29.39.24]:46844 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dcJ04-001KAQ-9A; Mon, 31 Jul 2017 16:17:20 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , , Pedro Alves Subject: Re: [RFA v2 10/24] Remove make_cleanup_restore_current_language References: <20170725172107.9799-1-tom@tromey.com> <20170725172107.9799-11-tom@tromey.com> <94022dcf-0cdb-f271-9b8c-66682ac41b1c@ericsson.com> Date: Mon, 31 Jul 2017 22:17:00 -0000 In-Reply-To: <94022dcf-0cdb-f271-9b8c-66682ac41b1c@ericsson.com> (Simon Marchi's message of "Mon, 31 Jul 2017 21:20:51 +0200") Message-ID: <87o9s08d5d.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Exim-ID: 1dcJ04-001KAQ-9A X-Source-Sender: 174-29-39-24.hlrn.qwest.net (bapiya) [174.29.39.24]:46844 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes X-SW-Source: 2017-07/txt/msg00464.txt.bz2 >>>>> "Simon" == Simon Marchi writes: >> + explicit scoped_restore_language (enum language new_lang) >> + : m_lang (current_language->la_language) >> + { >> + set_language (new_lang); >> + } Simon> To follow the nomenclature and behavior of other scoped_restore_* Simon> , I think this: Simon> 1. should be named scoped_restore_current_language Ok. Simon> 2. should only only save and restore the current language, and Simon> not set the new language. scoped_restore allows setting the new value. That's what I was copying here. From scoped_restore.h: /* Create a new scoped_restore object that saves the current value of *VAR, and sets *VAR to VALUE. *VAR will be restored when this scoped_restore object is destroyed. This is templated on T2 to allow passing VALUEs of types convertible to T. E.g.: T='base'; T2='derived'. */ template scoped_restore_tmpl (T *var, T2 value) : scoped_restore_base (var), m_saved_value (*var) { *var = value; } Tom