public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] gdb/cli: convert cli_suppress_notification from int to bool
Date: Wed,  1 Dec 2021 16:08:27 +0100	[thread overview]
Message-ID: <d843658ee074982e5cf621d63e075abf898f5899.1638370938.git.tankut.baris.aktemur@intel.com> (raw)
In-Reply-To: <cover.1638370938.git.tankut.baris.aktemur@intel.com>

Convert the suppress_notification flag for the CLI from int to bool.
---
 gdb/cli/cli-decode.c | 10 +++++-----
 gdb/cli/cli-decode.h |  2 +-
 gdb/cli/cli-interp.c |  5 +----
 gdb/command.h        |  8 ++++----
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 030cba44338..ebe6b924bf8 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -239,7 +239,7 @@ struct cmd_list_element *
 add_cmd_suppress_notification (const char *name, enum command_class theclass,
 			       cmd_simple_func_ftype *fun, const char *doc,
 			       struct cmd_list_element **list,
-			       int *suppress_notification)
+			       bool *suppress_notification)
 {
   struct cmd_list_element *element;
 
@@ -438,7 +438,7 @@ add_prefix_cmd_suppress_notification
 		cmd_simple_func_ftype *fun,
 		const char *doc, struct cmd_list_element **subcommands,
 		int allow_unknown, struct cmd_list_element **list,
-		int *suppress_notification)
+		bool *suppress_notification)
 {
   struct cmd_list_element *element
     = add_prefix_cmd (name, theclass, fun, doc, subcommands,
@@ -1312,7 +1312,7 @@ add_com_alias (const char *name, cmd_list_element *target,
 struct cmd_list_element *
 add_com_suppress_notification (const char *name, enum command_class theclass,
 			       cmd_simple_func_ftype *fun, const char *doc,
-			       int *suppress_notification)
+			       bool *suppress_notification)
 {
   return add_cmd_suppress_notification (name, theclass, fun, doc,
 					&cmdlist, suppress_notification);
@@ -2467,10 +2467,10 @@ cmd_func (struct cmd_list_element *cmd, const char *args, int from_tty)
 {
   if (!cmd->is_command_class_help ())
     {
-      gdb::optional<scoped_restore_tmpl<int>> restore_suppress;
+      gdb::optional<scoped_restore_tmpl<bool>> restore_suppress;
 
       if (cmd->suppress_notification != NULL)
-	restore_suppress.emplace (cmd->suppress_notification, 1);
+	restore_suppress.emplace (cmd->suppress_notification, true);
 
       cmd->func (args, from_tty, cmd);
     }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index f7945ba2bf5..eee24bf8677 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -256,7 +256,7 @@ struct cmd_list_element
      cli_suppress_notification', which will be set to true in cmd_func
      when this command is being executed.  It will be set back to false
      when the command has been executed.  */
-  int *suppress_notification = nullptr;
+  bool *suppress_notification = nullptr;
 
 private:
   /* Local state (context) for this command.  This can be anything.  */
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 47d1eff0547..db5e313d36e 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -68,10 +68,7 @@ cli_interp::~cli_interp ()
 }
 
 /* Suppress notification struct.  */
-struct cli_suppress_notification cli_suppress_notification =
-  {
-    0   /* user_selected_context_changed */
-  };
+struct cli_suppress_notification cli_suppress_notification;
 
 /* Returns the INTERP's data cast as cli_interp if INTERP is a CLI,
    and returns NULL otherwise.  */
diff --git a/gdb/command.h b/gdb/command.h
index bcd3882f811..6ae57dcc030 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -378,7 +378,7 @@ typedef void cmd_simple_func_ftype (const char *args, int from_tty);
 struct cli_suppress_notification
 {
   /* Inferior, thread, frame selected notification suppressed?  */
-  int user_selected_context;
+  bool user_selected_context = false;
 };
 
 extern struct cli_suppress_notification cli_suppress_notification;
@@ -421,7 +421,7 @@ extern struct cmd_list_element *add_cmd_suppress_notification
 			(const char *name, enum command_class theclass,
 			 cmd_simple_func_ftype *fun, const char *doc,
 			 struct cmd_list_element **list,
-			 int *suppress_notification);
+			 bool *suppress_notification);
 
 extern struct cmd_list_element *add_alias_cmd (const char *,
 					       cmd_list_element *,
@@ -467,7 +467,7 @@ extern struct cmd_list_element *add_prefix_cmd_suppress_notification
 			 const char *doc, struct cmd_list_element **subcommands,
 			 int allow_unknown,
 			 struct cmd_list_element **list,
-			 int *suppress_notification);
+			 bool *suppress_notification);
 
 extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 						       enum command_class,
@@ -615,7 +615,7 @@ extern cmd_list_element *add_com_alias (const char *name,
 extern struct cmd_list_element *add_com_suppress_notification
 		       (const char *name, enum command_class theclass,
 			cmd_simple_func_ftype *fun, const char *doc,
-			int *supress_notification);
+			bool *supress_notification);
 
 extern struct cmd_list_element *add_info (const char *,
 					  cmd_simple_func_ftype *fun,
-- 
2.33.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  reply	other threads:[~2021-12-01 15:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 15:08 [PATCH 0/3] Suppressing CLI notifications Tankut Baris Aktemur
2021-12-01 15:08 ` Tankut Baris Aktemur [this message]
2022-01-14 15:52   ` [PATCH 1/3] gdb/cli: convert cli_suppress_notification from int to bool Tom Tromey
2021-12-01 15:08 ` [PATCH 2/3] gdb/cli: add a 'normal_stop' option to 'cli_suppress_notification' Tankut Baris Aktemur
2022-01-14 16:01   ` Tom Tromey
2021-12-01 15:08 ` [PATCH 3/3] gdb: add the 'set/show suppress-notification-cli' command Tankut Baris Aktemur
2022-01-14 16:04   ` Tom Tromey
2022-01-18 10:41   ` Andrew Burgess
2022-01-14 12:13 ` [PATCH 0/3] Suppressing CLI notifications Aktemur, Tankut Baris

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=d843658ee074982e5cf621d63e075abf898f5899.1638370938.git.tankut.baris.aktemur@intel.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).