Move declaration of max_user_call_depth to header
Commit Message
Also removes an unnecessary declaration of cmdlist in cli-cmds.c.
I don't understand why it is there, the definition of cmdlist is
at the top of the same file.
gdb/ChangeLog:
2019-10-09 Christian Biesinger <cbiesinger@google.com>
* cli/cli-cmds.c (max_user_call_depth): Move comment to header.
(show_user): Remove declaration of cmdlist.
* cli/cli-cmds.h (max_user_call_depth): Declare.
* cli/cli-script.c (execute_user_command): Remove declaration
of max_user_call_depth.
---
gdb/cli/cli-cmds.c | 3 +--
gdb/cli/cli-cmds.h | 4 ++++
gdb/cli/cli-script.c | 1 -
3 files changed, 5 insertions(+), 3 deletions(-)
Comments
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
Christian> 2019-10-09 Christian Biesinger <cbiesinger@google.com>
Christian> * cli/cli-cmds.c (max_user_call_depth): Move comment to header.
Christian> (show_user): Remove declaration of cmdlist.
Christian> * cli/cli-cmds.h (max_user_call_depth): Declare.
Christian> * cli/cli-script.c (execute_user_command): Remove declaration
Christian> of max_user_call_depth.
Thanks, this is ok.
Christian> /* Define all cmd_list_elements. */
Christian> @@ -1538,7 +1538,6 @@ static void
Christian> show_user (const char *args, int from_tty)
Christian> {
Christian> struct cmd_list_element *c;
Christian> - extern struct cmd_list_element *cmdlist;
Changes like this particular one qualify as obvious IMO.
Christian> I don't understand why it is there, the definition of cmdlist is
Christian> at the top of the same file.
Could be the result of an earlier refactoring, or just plain old
mistake.
Tom
On Fri, Oct 11, 2019 at 8:13 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> 2019-10-09 Christian Biesinger <cbiesinger@google.com>
>
> Christian> * cli/cli-cmds.c (max_user_call_depth): Move comment to header.
> Christian> (show_user): Remove declaration of cmdlist.
> Christian> * cli/cli-cmds.h (max_user_call_depth): Declare.
> Christian> * cli/cli-script.c (execute_user_command): Remove declaration
> Christian> of max_user_call_depth.
>
> Thanks, this is ok.
Thanks, pushed.
To ssh://sourceware.org/git/binutils-gdb.git
03d0d46a0e6..cc8dee1f1c6 HEAD -> master
Christian
> Christian> /* Define all cmd_list_elements. */
> Christian> @@ -1538,7 +1538,6 @@ static void
> Christian> show_user (const char *args, int from_tty)
> Christian> {
> Christian> struct cmd_list_element *c;
> Christian> - extern struct cmd_list_element *cmdlist;
>
> Changes like this particular one qualify as obvious IMO.
Thanks, will keep that in mind, in this case I wanted to make sure I
wasn't missing anything.
Christian
@@ -74,7 +74,7 @@ static void ambiguous_line_spec (gdb::array_view<const symtab_and_line> sals,
static void filter_sals (std::vector<symtab_and_line> &);
-/* Limit the call depth of user-defined commands */
+/* See cli-cmds.h. */
unsigned int max_user_call_depth;
/* Define all cmd_list_elements. */
@@ -1538,7 +1538,6 @@ static void
show_user (const char *args, int from_tty)
{
struct cmd_list_element *c;
- extern struct cmd_list_element *cmdlist;
if (args)
{
@@ -101,6 +101,10 @@ extern struct cmd_list_element *setchecklist;
extern struct cmd_list_element *showchecklist;
+/* Limit the call depth of user-defined commands */
+
+extern unsigned int max_user_call_depth;
+
/* Exported to gdb/top.c */
void init_cmd_lists (void);
@@ -449,7 +449,6 @@ void
execute_user_command (struct cmd_list_element *c, const char *args)
{
counted_command_line cmdlines_copy;
- extern unsigned int max_user_call_depth;
/* Ensure that the user commands can't be deleted while they are
executing. */