From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120725 invoked by alias); 31 Jul 2017 19:46:07 -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 120707 invoked by uid 89); 31 Jul 2017 19:46:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Jul 2017 19:46:06 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v6VJjxMM025067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Jul 2017 15:46:04 -0400 Received: by simark.ca (Postfix, from userid 112) id AB27C1EA05; Mon, 31 Jul 2017 15:45:59 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id CC02F1E5B1; Mon, 31 Jul 2017 15:45:46 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 31 Jul 2017 19:46:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA v2 17/24] Remove user_call_depth In-Reply-To: <20170725172107.9799-18-tom@tromey.com> References: <20170725172107.9799-1-tom@tromey.com> <20170725172107.9799-18-tom@tromey.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 31 Jul 2017 19:45:59 +0000 X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00456.txt.bz2 On 2017-07-25 19:21, Tom Tromey wrote: > This changes execute_user_command to remove user_call_depth, using the > size of user_args_stack instead. This avoids a cleanup. > > ChangeLog > 2017-07-25 Tom Tromey > > * cli/cli-script.c (do_restore_user_call_depth): Remove. > (execute_user_command): Remove user_call_depth; use > user_args_stack's size instead. > --- > gdb/ChangeLog | 6 ++++++ > gdb/cli/cli-script.c | 18 ++++-------------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index 8564f9f..f81185a 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,5 +1,11 @@ > 2017-07-25 Tom Tromey > > + * cli/cli-script.c (do_restore_user_call_depth): Remove. > + (execute_user_command): Remove user_call_depth; use > + user_args_stack's size instead. > + > +2017-07-25 Tom Tromey > + > * top.h (in_user_command): Remove. > * top.c (in_user_command): Remove. > * cli/cli-script.c (do_restore_user_call_depth) > diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c > index 527540a..edaebef 100644 > --- a/gdb/cli/cli-script.c > +++ b/gdb/cli/cli-script.c > @@ -372,16 +372,6 @@ execute_cmd_post_hook (struct cmd_list_element *c) > } > } > > -/* Execute the command in CMD. */ > -static void > -do_restore_user_call_depth (void * call_depth) > -{ > - int *depth = (int *) call_depth; > - > - (*depth)--; > -} > - > - > void > execute_user_command (struct cmd_list_element *c, char *args) > { > @@ -398,15 +388,15 @@ execute_user_command (struct cmd_list_element > *c, char *args) > return; > > scoped_user_args_level push_user_args (args); > + scoped_restore restore_call_depth > + = make_scoped_restore (&user_call_depth, user_call_depth + 1); > > - if (++user_call_depth > max_user_call_depth) > + if (user_call_depth > max_user_call_depth) > error (_("Max user call depth exceeded -- command aborted.")); > > - old_chain = make_cleanup (do_restore_user_call_depth, > &user_call_depth); > - > /* Set the instream to 0, indicating execution of a > user-defined function. */ > - make_cleanup (do_restore_instream_cleanup, ui->instream); > + old_chain = make_cleanup (do_restore_instream_cleanup, > ui->instream); > ui->instream = NULL; > > scoped_restore save_async = make_scoped_restore (¤t_ui->async, > 0); Hi Tom, This patch seems to still contain the changes of v1. Simon