This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 17/23] Use a scoped_restore for user_call_depth
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Mon, 5 Jun 2017 14:32:52 +0100
- Subject: Re: [RFA 17/23] Use a scoped_restore for user_call_depth
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AF8E8C057F90
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF8E8C057F90
- References: <20170503224626.2818-1-tom@tromey.com> <20170503224626.2818-18-tom@tromey.com>
On 05/03/2017 11:46 PM, Tom Tromey wrote:
> -
> 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."));
>
How about we remove the user_call_depth variable and check
user_args_stack.size () instead ?
Thanks,
Pedro Alves