From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24637 invoked by alias); 15 Jan 2017 21:52:41 -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 24626 invoked by uid 89); 15 Jan 2017 21:52:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-PHP-Originating-Script:rcube.php, HTo:U*tom, UD:ui-out.h, ui-out.h X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Jan 2017 21:52:30 +0000 Received: by simark.ca (Postfix, from userid 33) id 9838C1E86E; Sun, 15 Jan 2017 16:52:28 -0500 (EST) To: Tom Tromey Subject: Re: [RFA 1/5] Remove some ui_out-related cleanups from Python X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 15 Jan 2017 21:52:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <20170115134253.24018-2-tom@tromey.com> References: <20170115134253.24018-1-tom@tromey.com> <20170115134253.24018-2-tom@tromey.com> Message-ID: <292eaf92be7c57825d139958933c72fd@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00283.txt.bz2 On 2017-01-15 08:42, Tom Tromey wrote: > This patch introduces a bit of infrastructure -- namely, a minimal > std::optional analogue called gdb::optional, and an RAII template > class that works like make_cleanup_ui_out_tuple_begin_end or > make_cleanup_ui_out_list_begin_end -- and then uses these in the > Python code. This removes a number of cleanups and generally > simplifies this code. > > std::optional is only available in C++17. Normally I would have had > this code check __cplusplus, but my gcc apparently isn't new enough to > find , even with -std=c++1z; so, because I could not test > it, the patch does not do this. > > 2017-01-15 Tom Tromey > > * ui-out.h (ui_out_emit_type): New class. > (ui_out_emit_tuple, ui_out_emit_list): New typedefs. > * python/py-framefilter.c (py_print_single_arg): Use gdb::optional > and ui_out_emit_tuple. > (enumerate_locals): Likewise. > (py_mi_print_variables, py_print_locals, py_print_args): Use > ui_out_emit_list. > (py_print_frame): Use gdb::optional, ui_out_emit_tuple, > ui_out_emit_list. > * common/gdb_option.h: New file. > --- > gdb/ChangeLog | 13 +++ > gdb/common/gdb_option.h | 87 ++++++++++++++++++ Any reason you did not name this gdb_optional.h? Otherwise, it looks really nice.