From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116179 invoked by alias); 28 Jan 2020 03:12:16 -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 116171 invoked by uid 89); 28 Jan 2020 03:12:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-pl1-f202.google.com Received: from mail-pl1-f202.google.com (HELO mail-pl1-f202.google.com) (209.85.214.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2020 03:12:14 +0000 Received: by mail-pl1-f202.google.com with SMTP id h8so4891434plr.11 for ; Mon, 27 Jan 2020 19:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=rzXkstBmNCZNeXDJZVcghjXSWQ6qZ/UzzoPenfiKYsY=; b=ph0zpXR7cNmqMQ+bZMt7DUU/Jo8uNj1KvTwjC4yepq+7sVHZgq5qJkgJRCetPW+nmu J1gXflowTSld8/tlbjbv6vuUk2IZNyrj8jN3dYD1AmtoknsthsLbvTTe1DOD6AfLyq3u 4tuJRwmUQ8+kMsPUPNSnJj7r9X8kB3pbj4DiwPIizwud09ZMkwZk9wZQh82sa5ZP2j3k TE6QVQSI7tLqDaUPbgGxtRoTlBGCarUhRgqJAdZySS/5d8o0+cJYjymL1r2EQNsIlhC9 Rt9KKEaussNUxa568SibrG55xvrgXi1b4ToL0q1sGiZbQrVDixSspW6I/nAVVQUpCEz+ DpLA== Date: Tue, 28 Jan 2020 10:14:00 -0000 In-Reply-To: <87a76a6vwn.fsf@tromey.com> Message-Id: <20200128031206.108562-1-tamur@google.com> Mime-Version: 1.0 Subject: [PATCH] Disambiguate info_print_options From: "Ali Tamur via gdb-patches" Reply-To: Ali Tamur To: gdb-patches@sourceware.org Cc: tom@tromey.com, Ali Tamur Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00896.txt.bz2 > So how about "info_vars_funcs_options"? > > Maybe make_info_sources_options_def_group should be renamed as well. > And perhaps info_print_command_completer.=C2=A0 My thinking here is that = it > is best if the related names are all consistent. Renamed info_print_options, info_print_options_defs, make_info_print_options_def_group, info_print_command_completer. Did not rename make_info_sources_options_def_group; it seems not directly related? Please take another look, thank you. --- struct info_print_options is defined in both symtab.c and stack.c, which is an ODR violation. So, I am renaming info_print_options and related structs/functions in symtab.c: info_print_options =3D=3D> info_vars_funcs_options info_print_options_defs =3D=3D> info_vars_funcs_options_defs make_info_print_options_def_group =3D=3D> make_info_vars_funcs_options_def_= group info_print_command_completer =3D=3D> info_vars_funcs_command_completer gdb/ChangeLog: * symtab.c (info_print_options): Rename to info_vars_funcs_options. (info_print_options_defs): Rename to info_vars_funcs_options_defs. (make_info_print_options_def_group): Rename to make_info_vars_funcs_options_def_group. (info_print_command_completer): Rename to info_vars_funcs_command_completer. (info_variables_command): Apply name changes. (info_functions_command): Likewise. (_initialize_symtab): Likewise. --- gdb/symtab.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index f456f4d852..d99be41261 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4976,13 +4976,13 @@ symtab_symbol_info (bool quiet, bool exclude_minsym= s, and 'info functions' commands. These correspond to the -q, -t, and -n options. */ =20 -struct info_print_options +struct info_vars_funcs_options { bool quiet =3D false; bool exclude_minsyms =3D false; char *type_regexp =3D nullptr; =20 - ~info_print_options () + ~info_vars_funcs_options () { xfree (type_regexp); } @@ -4991,24 +4991,25 @@ struct info_print_options /* The options used by the 'info variables' and 'info functions' commands. */ =20 -static const gdb::option::option_def info_print_options_defs[] =3D { - gdb::option::boolean_option_def { +static const gdb::option::option_def info_vars_funcs_options_defs[] =3D { + gdb::option::boolean_option_def { "q", - [] (info_print_options *opt) { return &opt->quiet; }, + [] (info_vars_funcs_options *opt) { return &opt->quiet; }, nullptr, /* show_cmd_cb */ nullptr /* set_doc */ }, =20 - gdb::option::boolean_option_def { + gdb::option::boolean_option_def { "n", - [] (info_print_options *opt) { return &opt->exclude_minsyms; }, + [] (info_vars_funcs_options *opt) { return &opt->exclude_minsyms; }, nullptr, /* show_cmd_cb */ nullptr /* set_doc */ }, =20 - gdb::option::string_option_def { + gdb::option::string_option_def { "t", - [] (info_print_options *opt) { return &opt->type_regexp; }, + [] (info_vars_funcs_options *opt) { return &opt->type_regexp; + }, nullptr, /* show_cmd_cb */ nullptr /* set_doc */ } @@ -5018,20 +5019,20 @@ static const gdb::option::option_def info_print_opt= ions_defs[] =3D { functions'. */ =20 static gdb::option::option_def_group -make_info_print_options_def_group (info_print_options *opts) +make_info_vars_funcs_options_def_group (info_vars_funcs_options *opts) { - return {{info_print_options_defs}, opts}; + return {{info_vars_funcs_options_defs}, opts}; } =20 /* Command completer for 'info variables' and 'info functions'. */ =20 static void -info_print_command_completer (struct cmd_list_element *ignore, - completion_tracker &tracker, - const char *text, const char * /* word */) +info_vars_funcs_command_completer (struct cmd_list_element *ignore, + completion_tracker &tracker, + const char *text, const char * /* word */) { const auto group - =3D make_info_print_options_def_group (nullptr); + =3D make_info_vars_funcs_options_def_group (nullptr); if (gdb::option::complete_options (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, gr= oup)) return; @@ -5045,8 +5046,8 @@ info_print_command_completer (struct cmd_list_element= *ignore, static void info_variables_command (const char *args, int from_tty) { - info_print_options opts; - auto grp =3D make_info_print_options_def_group (&opts); + info_vars_funcs_options opts; + auto grp =3D make_info_vars_funcs_options_def_group (&opts); gdb::option::process_options (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp); if (args !=3D nullptr && *args =3D=3D '\0') @@ -5061,8 +5062,9 @@ info_variables_command (const char *args, int from_tt= y) static void info_functions_command (const char *args, int from_tty) { - info_print_options opts; - auto grp =3D make_info_print_options_def_group (&opts); + info_vars_funcs_options opts; + + auto grp =3D make_info_vars_funcs_options_def_group (&opts); gdb::option::process_options (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp); if (args !=3D nullptr && *args =3D=3D '\0') @@ -6709,7 +6711,7 @@ Usage: info variables [-q] [-n] [-t TYPEREGEXP] [NAME= REGEXP]\n\ Prints the global and static variables.\n"), _("global and static variables"), true)); - set_cmd_completer_handle_brkchars (c, info_print_command_completer); + set_cmd_completer_handle_brkchars (c, info_vars_funcs_command_completer); if (dbx_commands) { c =3D add_com ("whereis", class_info, info_variables_command, @@ -6719,7 +6721,7 @@ Usage: whereis [-q] [-n] [-t TYPEREGEXP] [NAMEREGEXP]= \n\ Prints the global and static variables.\n"), _("global and static variables"), true)); - set_cmd_completer_handle_brkchars (c, info_print_command_completer); + set_cmd_completer_handle_brkchars (c, info_vars_funcs_command_comple= ter); } =20 c =3D add_info ("functions", info_functions_command, @@ -6729,7 +6731,7 @@ Usage: info functions [-q] [-n] [-t TYPEREGEXP] [NAME= REGEXP]\n\ Prints the functions.\n"), _("functions"), true)); - set_cmd_completer_handle_brkchars (c, info_print_command_completer); + set_cmd_completer_handle_brkchars (c, info_vars_funcs_command_completer); =20 c =3D add_info ("types", info_types_command, _("\ All type names, or those matching REGEXP.\n\ --=20 2.25.0.341.g760bfbb309-goog