Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH 12/24] Introduce generic command options framework
Date: Sat, 25 May 2019 10:31:00 -0000	[thread overview]
Message-ID: <4f861909-e59d-01ae-fab7-cd8527f1fa63@redhat.com> (raw)
In-Reply-To: <1558770207.1454.19.camel@skynet.be>

On 5/25/19 8:43 AM, Philippe Waroquiers wrote:
> While quickly scanning the patch, I found a few typos ...

Thanks!

> 
> On Wed, 2019-05-22 at 21:53 +0100, Pedro Alves wrote:
>> diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c
>> new file mode 100644
>> index 00000000000..432555a953f
>> --- /dev/null
>> +++ b/gdb/cli/cli-option.c
> ...
>> +/* Helper for build_help.  Appends an indended version of DOC into
>> +   HELP.  */
> indended -> indented 
>> +
>> +static void
>> +append_indended_doc (const char *doc, std::string &help)
> Same in the function name
> 

Fixed.

> 
>> diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
>> new file mode 100644
>> index 00000000000..437fc09a61b
>> --- /dev/null
>> +++ b/gdb/cli/cli-option.h
> ...
>> +struct option_def
>> +{
>> +  /* The ctor is protected because you're supposed to construct using
>> +     one of bool_option_def, etc. below.  */
>> +protected:
>> +  typedef void *(erased_var_address_ftype) ();
>> +
>> +  /* Construct an option.  NAME_ is the option's name.  VAR_TYPE_
>> +     defines the option's type.  ERASED_VAR_ADDRESS_ is a pointer to
>> +     the option's control variable.  SHOW_CMD_CB_ is a pointer to
> Isn't ERASED_VAR_ADDRESS_ the address of a function ?

You're right.  I think it wasn't at some point...  I've renamed it
and everything related to include "get_" in the name.

> 
> 
>> diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
>> new file mode 100644
>> index 00000000000..924d7aa544e
>> --- /dev/null
>> +++ b/gdb/testsuite/gdb.base/options.exp
> ...
>>
>> +# Miscelaneous tests.
> Miscellaneous
> 

Fixed.

Here's the patch that I'm squashing in.

From 4bce43c41d08f88c5ae598d54adec9097dbdeab3 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Sat, 25 May 2019 11:24:51 +0100
Subject: [PATCH] philippe review

---
 gdb/cli/cli-option.c               |  8 ++++----
 gdb/cli/cli-option.h               | 36 ++++++++++++++++++------------------
 gdb/testsuite/gdb.base/options.exp |  2 +-
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c
index 432555a953f..9793dd5727e 100644
--- a/gdb/cli/cli-option.c
+++ b/gdb/cli/cli-option.c
@@ -601,11 +601,11 @@ get_val_type_str (const option_def &opt, std::string &buffer)
     }
 }
 
-/* Helper for build_help.  Appends an indended version of DOC into
+/* Helper for build_help.  Appends an indented version of DOC into
    HELP.  */
 
 static void
-append_indended_doc (const char *doc, std::string &help)
+append_indented_doc (const char *doc, std::string &help)
 {
   const char *p = doc;
   const char *n = strchr (p, '\n');
@@ -646,9 +646,9 @@ build_help_option (gdb::array_view<const option_def> options,
 	  help += val_type_str;
 	}
       help += "\n";
-      append_indended_doc (o.set_doc, help);
+      append_indented_doc (o.set_doc, help);
       if (o.help_doc != nullptr)
-	append_indended_doc (o.help_doc, help);
+	append_indented_doc (o.help_doc, help);
       help += '\n';
     }
 }
diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
index 437fc09a61b..1bfbfce1ce5 100644
--- a/gdb/cli/cli-option.h
+++ b/gdb/cli/cli-option.h
@@ -39,23 +39,23 @@ struct option_def
   /* The ctor is protected because you're supposed to construct using
      one of bool_option_def, etc. below.  */
 protected:
-  typedef void *(erased_var_address_ftype) ();
+  typedef void *(erased_get_var_address_ftype) ();
 
   /* Construct an option.  NAME_ is the option's name.  VAR_TYPE_
-     defines the option's type.  ERASED_VAR_ADDRESS_ is a pointer to
-     the option's control variable.  SHOW_CMD_CB_ is a pointer to
-     callback for the "show" command that is installed for this
-     option.  SET_DOC_, SHOW_DOC_, HELP_DOC_ are used to create the
-     option's "set/show" commands.  */
+     defines the option's type.  ERASED_GET_VAR_ADDRESS_ is a pointer
+     to a function that returns the option's control variable.
+     SHOW_CMD_CB_ is a pointer to callback for the "show" command that
+     is installed for this option.  SET_DOC_, SHOW_DOC_, HELP_DOC_ are
+     used to create the option's "set/show" commands.  */
   constexpr option_def (const char *name_,
 			var_types var_type_,
-			erased_var_address_ftype *erased_var_address_,
+			erased_get_var_address_ftype *erased_get_var_address_,
 			show_value_ftype *show_cmd_cb_,
 			const char *set_doc_,
 			const char *show_doc_,
 			const char *help_doc_)
     : name (name_), type (var_type_),
-      erased_var_address (erased_var_address_),
+      erased_get_var_address (erased_get_var_address_),
       var_address {},
       show_cmd_cb (show_cmd_cb_),
       set_doc (set_doc_), show_doc (show_doc_), help_doc (help_doc_)
@@ -70,7 +70,7 @@ public:
 
   /* A function that gets the controlling variable's address, type
      erased.  */
-  erased_var_address_ftype *erased_var_address;
+  erased_get_var_address_ftype *erased_get_var_address;
 
   /* Get the controlling variable's address.  Each type of variable
      uses a different union member.  We do this instead of having a
@@ -128,7 +128,7 @@ static inline RetType *
 get_var_address (const option_def &option, void *ctx)
 {
   using unerased_ftype = RetType *(Context *);
-  unerased_ftype *fun = (unerased_ftype *) option.erased_var_address;
+  unerased_ftype *fun = (unerased_ftype *) option.erased_get_var_address;
   return fun ((Context *) ctx);
 }
 
@@ -154,13 +154,13 @@ template<typename Context>
 struct boolean_option_def : option_def
 {
   boolean_option_def (const char *long_option_,
-		      int *(*var_address_cb_) (Context *),
+		      int *(*get_var_address_cb_) (Context *),
 		      show_value_ftype *show_cmd_cb_,
 		      const char *set_doc_,
 		      const char *show_doc_ = nullptr,
 		      const char *help_doc_ = nullptr)
     : option_def (long_option_, var_boolean,
-		  (erased_var_address_ftype *) var_address_cb_,
+		  (erased_get_var_address_ftype *) get_var_address_cb_,
 		  show_cmd_cb_,
 		  set_doc_, show_doc_, help_doc_)
   {
@@ -205,13 +205,13 @@ template<typename Context>
 struct uinteger_option_def : option_def
 {
   uinteger_option_def (const char *long_option_,
-		       unsigned int *(*var_address_cb_) (Context *),
+		       unsigned int *(*get_var_address_cb_) (Context *),
 		       show_value_ftype *show_cmd_cb_,
 		       const char *set_doc_,
 		       const char *show_doc_ = nullptr,
 		       const char *help_doc_ = nullptr)
     : option_def (long_option_, var_uinteger,
-		  (erased_var_address_ftype *) var_address_cb_,
+		  (erased_get_var_address_ftype *) get_var_address_cb_,
 		  show_cmd_cb_,
 		  set_doc_, show_doc_, help_doc_)
   {
@@ -225,13 +225,13 @@ template<typename Context>
 struct zuinteger_unlimited_option_def : option_def
 {
   zuinteger_unlimited_option_def (const char *long_option_,
-				  int *(*var_address_cb_) (Context *),
+				  int *(*get_var_address_cb_) (Context *),
 				  show_value_ftype *show_cmd_cb_,
 				  const char *set_doc_,
 				  const char *show_doc_ = nullptr,
 				  const char *help_doc_ = nullptr)
     : option_def (long_option_, var_zuinteger_unlimited,
-		  (erased_var_address_ftype *) var_address_cb_,
+		  (erased_get_var_address_ftype *) get_var_address_cb_,
 		  show_cmd_cb_,
 		  set_doc_, show_doc_, help_doc_)
   {
@@ -246,13 +246,13 @@ struct enum_option_def : option_def
 {
   enum_option_def (const char *long_option_,
 		   const char *const *enumlist,
-		   const char **(*var_address_cb_) (Context *),
+		   const char **(*get_var_address_cb_) (Context *),
 		   show_value_ftype *show_cmd_cb_,
 		   const char *set_doc_,
 		   const char *show_doc_ = nullptr,
 		   const char *help_doc_ = nullptr)
     : option_def (long_option_, var_enum,
-		  (erased_var_address_ftype *) var_address_cb_,
+		  (erased_get_var_address_ftype *) get_var_address_cb_,
 		  show_cmd_cb_,
 		  set_doc_, show_doc_, help_doc_)
   {
diff --git a/gdb/testsuite/gdb.base/options.exp b/gdb/testsuite/gdb.base/options.exp
index 924d7aa544e..1891176dc1d 100644
--- a/gdb/testsuite/gdb.base/options.exp
+++ b/gdb/testsuite/gdb.base/options.exp
@@ -117,7 +117,7 @@ set all_options {
     "-zuinteger-unlimited"
 }
 
-# Miscelaneous tests.
+# Miscellaneous tests.
 proc_with_prefix test-misc {variant} {
     global all_options
 
-- 
2.14.5


  reply	other threads:[~2019-05-25 10:31 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 20:53 [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options Pedro Alves
2019-05-22 20:53 ` [PATCH 11/24] number_or_range_parser::get_number, don't treat "1 -" as a range Pedro Alves
2019-05-22 20:53 ` [PATCH 04/24] Make check_for_argument skip whitespace after arg itself Pedro Alves
2019-05-22 20:53 ` [PATCH 18/24] lib/completion-support.exp: Add test_gdb_completion_offers_commands Pedro Alves
2019-05-22 20:53 ` [PATCH 08/24] gdb.base/settings.exp: Fix comment typo Pedro Alves
2019-05-24 11:40   ` Pedro Alves
2019-05-22 20:53 ` [PATCH 07/24] Remove "show" command completers Pedro Alves
2019-05-23 19:28   ` Sergio Durigan Junior
2019-05-24 11:25     ` Pedro Alves
2019-05-24 14:21       ` Sergio Durigan Junior
2019-05-22 20:53 ` [PATCH 03/24] Fix TID parser bug Pedro Alves
2019-05-22 20:53 ` [PATCH 15/24] Introduce rename_cmd Pedro Alves
2019-05-25 19:58   ` Philippe Waroquiers
2019-05-29 16:03     ` Pedro Alves
2019-05-29 18:30       ` Pedro Alves
2019-05-30 10:22         ` Philippe Waroquiers
2019-05-30 20:01           ` Pedro Alves
2019-05-22 20:53 ` [PATCH 19/24] Introduce complete_command Pedro Alves
2019-05-22 20:54 ` [PATCH 02/24] Fix latent bug with custom word point completers Pedro Alves
2019-05-22 20:54 ` [PATCH 01/24] Fix latent bug in custom word point completion handling Pedro Alves
2019-05-22 20:54 ` [PATCH 14/24] Migrate rest of compile commands to new options framework Pedro Alves
2019-05-22 20:54 ` [PATCH 20/24] Make "frame apply" support -OPT options Pedro Alves
2019-05-25 20:12   ` Philippe Waroquiers
2019-05-29 15:13     ` Pedro Alves
2019-05-29 15:25       ` Pedro Alves
2019-05-22 20:54 ` [PATCH 10/24] boolean/auto-boolean commands, make "o" ambiguous Pedro Alves
2019-05-22 20:54 ` [PATCH 22/24] Make "thread apply" use the gdb::option framework Pedro Alves
2019-05-25 20:24   ` Philippe Waroquiers
2019-05-29 15:38     ` Pedro Alves
2019-05-22 20:54 ` [PATCH 06/24] Fix "set enum-command value garbage" Pedro Alves
2019-05-23 19:13   ` Sergio Durigan Junior
2019-05-24 11:39     ` Pedro Alves
2019-05-22 20:54 ` [PATCH 05/24] Allow "unlimited" abbreviations Pedro Alves
2019-05-22 20:54 ` [PATCH 09/24] New set/show testing framework (gdb.base/settings.exp) Pedro Alves
2019-05-23  4:15   ` Eli Zaretskii
2019-05-22 20:54 ` [PATCH 21/24] "thread apply 1 -- -" vs "frame apply level 0 -- -" Pedro Alves
2019-05-22 20:54 ` [PATCH 12/24] Introduce generic command options framework Pedro Alves
2019-05-25  7:43   ` Philippe Waroquiers
2019-05-25 10:31     ` Pedro Alves [this message]
2019-05-22 20:58 ` [PATCH 13/24] Make "print" and "compile print" support -OPT options Pedro Alves
2019-05-24 19:49   ` Sergio Durigan Junior
2019-05-25 10:10     ` Pedro Alves
2019-05-25 10:37       ` Andreas Schwab
2019-05-22 20:58 ` [PATCH 16/24] Make "backtrace" " Pedro Alves
2019-05-22 21:00 ` [PATCH 17/24] "backtrace full/no-filters/hide" completer Pedro Alves
2019-05-22 21:00 ` [PATCH 24/24] NEWS and manual changes for command options changes Pedro Alves
2019-05-23  4:31   ` Eli Zaretskii
2019-05-23 15:01     ` Pedro Alves
2019-05-23 15:07       ` Eli Zaretskii
2019-05-23 15:31         ` Pedro Alves
2019-05-25 20:40   ` Philippe Waroquiers
2019-05-29 16:03     ` Pedro Alves
2019-05-22 21:03 ` [PATCH 23/24] Delete parse_flags/parse_flags_qcs Pedro Alves
2019-05-22 21:46 ` [PATCH 00/24] gdb::option framework, "print -OPT", other cmd options Pedro Alves
2019-05-24 19:58 ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f861909-e59d-01ae-fab7-cd8527f1fa63@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox