public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [FYI 3/7] Use "false" in select_frame_for_mi
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
  2019-05-04 20:11 ` [FYI 2/7] Change valid_command_p to return bool Tom Tromey
@ 2019-05-04 20:11 ` Tom Tromey
  2019-05-04 20:11 ` [FYI 4/7] Use bool, true, and false in arc-tdep.c Tom Tromey
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes select_frame_for_mi to use "false" rather than "FALSE".

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* stack.c (select_frame_for_mi): Use "false", not "FALSE".
---
 gdb/ChangeLog | 4 ++++
 gdb/stack.c   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/stack.c b/gdb/stack.c
index e5de10949d0..408c795e385 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1653,7 +1653,7 @@ select_frame_command_core (struct frame_info *fi, bool ignored)
 void
 select_frame_for_mi (struct frame_info *fi)
 {
-  select_frame_command_core (fi, FALSE /* Ignored.  */);
+  select_frame_command_core (fi, false /* Ignored.  */);
 }
 
 /* The core of all the "frame" sub-commands.  Select frame FI, and if this
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 4/7] Use bool, true, and false in arc-tdep.c
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
  2019-05-04 20:11 ` [FYI 2/7] Change valid_command_p to return bool Tom Tromey
  2019-05-04 20:11 ` [FYI 3/7] Use "false" in select_frame_for_mi Tom Tromey
@ 2019-05-04 20:11 ` Tom Tromey
  2019-05-04 20:11 ` [FYI 5/7] Use "false" in compile_cplus_convert_enum Tom Tromey
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes arc-tdep.c to use bool, true, and false.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* arc-tdep.c (arc_tdesc_init): Use bool.
---
 gdb/ChangeLog  | 4 ++++
 gdb/arc-tdep.c | 8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 009af1190a5..9c0296083d5 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1746,7 +1746,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
      tag.  */
   /* Cannot use arc_mach_is_arcv2 (), because gdbarch is not created yet.  */
   const int is_arcv2 = (info.bfd_arch_info->mach == bfd_mach_arc_arcv2);
-  int is_reduced_rf;
+  bool is_reduced_rf;
   const char *const *core_regs;
   const char *core_feature_name;
 
@@ -1806,7 +1806,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	  return FALSE;
 	}
 
-      is_reduced_rf = FALSE;
+      is_reduced_rf = false;
       core_feature_name = core_v2_feature_name;
       core_regs = core_v2_register_names;
     }
@@ -1822,7 +1822,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	      return FALSE;
 	    }
 
-	  is_reduced_rf = TRUE;
+	  is_reduced_rf = true;
 	  core_feature_name = core_reduced_v2_feature_name;
 	  core_regs = core_v2_register_names;
 	}
@@ -1839,7 +1839,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 		  return FALSE;
 		}
 
-	      is_reduced_rf = FALSE;
+	      is_reduced_rf = false;
 	      core_feature_name = core_arcompact_feature_name;
 	      core_regs = core_arcompact_register_names;
 	    }
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 2/7] Change valid_command_p to return bool
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
@ 2019-05-04 20:11 ` Tom Tromey
  2019-05-04 20:11 ` [FYI 3/7] Use "false" in select_frame_for_mi Tom Tromey
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes valid_command_p to return bool.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (valid_command_p): Return bool.
---
 gdb/ChangeLog      | 4 ++++
 gdb/cli/cli-cmds.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 5f3b973f060..3d8e2387ff7 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1355,9 +1355,9 @@ argv_to_string (char **argv, int n)
 }
 
 /* Subroutine of alias_command to simplify it.
-   Return TRUE if COMMAND exists, unambiguously.  Otherwise FALSE.  */
+   Return true if COMMAND exists, unambiguously.  Otherwise false.  */
 
-static int
+static bool
 valid_command_p (const char *command)
 {
   struct cmd_list_element *c;
@@ -1365,7 +1365,7 @@ valid_command_p (const char *command)
   c = lookup_cmd_1 (& command, cmdlist, NULL, 1);
 
   if (c == NULL || c == (struct cmd_list_element *) -1)
-    return FALSE;
+    return false;
 
   /* This is the slightly tricky part.
      lookup_cmd_1 will return a pointer to the last part of COMMAND
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 5/7] Use "false" in compile_cplus_convert_enum
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
                   ` (2 preceding siblings ...)
  2019-05-04 20:11 ` [FYI 4/7] Use bool, true, and false in arc-tdep.c Tom Tromey
@ 2019-05-04 20:11 ` Tom Tromey
  2019-05-04 20:12 ` [FYI 7/7] Change arc_tdesc_init to return bool Tom Tromey
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes compile_cplus_convert_enum to use "false".

Note that this variable is never modified, which seems like an error.
I filed PR compile/24473 for this.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* compile/compile-cplus-types.c (compile_cplus_convert_enum): Use
	"false".
---
 gdb/ChangeLog                     | 5 +++++
 gdb/compile/compile-cplus-types.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index ee3bb438a3b..692393085e2 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -910,7 +910,7 @@ static gcc_type
 compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
 			    enum gcc_cp_symbol_kind nested_access)
 {
-  int scoped_enum_p = FALSE;
+  bool scoped_enum_p = false;
 
   /* Create a new scope for this type.  */
   compile_scope scope = instance->new_scope (TYPE_NAME (type), type);
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 7/7] Change arc_tdesc_init to return bool
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
                   ` (3 preceding siblings ...)
  2019-05-04 20:11 ` [FYI 5/7] Use "false" in compile_cplus_convert_enum Tom Tromey
@ 2019-05-04 20:12 ` Tom Tromey
  2019-05-04 20:14 ` [FYI 1/7] Change valid_user_defined_cmd_name_p " Tom Tromey
  2019-05-04 20:14 ` [FYI 6/7] Use gdb_assert_not_reached in arm-linux-nat.c Tom Tromey
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes arc_tdesc_init to return bool.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* arc-tdep.c (arc_tdesc_init): Return bool.
---
 gdb/ChangeLog  |  4 ++++
 gdb/arc-tdep.c | 18 +++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 9c0296083d5..108b6717f7d 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1720,7 +1720,7 @@ static const struct frame_base arc_normal_base = {
    Returns TRUE if input tdesc was valid and in this case it will assign TDESC
    and TDESC_DATA output parameters.  */
 
-static int
+static bool
 arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 		struct tdesc_arch_data **tdesc_data)
 {
@@ -1803,7 +1803,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	{
 	  arc_print (_("Error: ARC v2 target description supplied for "
 		       "non-ARCv2 target.\n"));
-	  return FALSE;
+	  return false;
 	}
 
       is_reduced_rf = false;
@@ -1819,7 +1819,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	    {
 	      arc_print (_("Error: ARC v2 target description supplied for "
 			   "non-ARCv2 target.\n"));
-	      return FALSE;
+	      return false;
 	    }
 
 	  is_reduced_rf = true;
@@ -1836,7 +1836,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 		{
 		  arc_print (_("Error: ARCompact target description supplied "
 			       "for non-ARCompact target.\n"));
-		  return FALSE;
+		  return false;
 		}
 
 	      is_reduced_rf = false;
@@ -1847,7 +1847,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	    {
 	      arc_print (_("Error: Couldn't find core register feature in "
 			   "supplied target description."));
-	      return FALSE;
+	      return false;
 	    }
 	}
     }
@@ -1882,7 +1882,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 	  arc_print (_("Error: Cannot find required register `%s' in "
 		       "feature `%s'.\n"), core_regs[i], core_feature_name);
 	  tdesc_data_cleanup (tdesc_data_loc);
-	  return FALSE;
+	  return false;
 	}
     }
 
@@ -1894,7 +1894,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
       arc_print (_("Error: Cannot find required feature `%s' in supplied "
 		   "target description.\n"), aux_minimal_feature_name);
       tdesc_data_cleanup (tdesc_data_loc);
-      return FALSE;
+      return false;
     }
 
   for (int i = ARC_FIRST_AUX_REGNUM; i <= ARC_LAST_AUX_REGNUM; i++)
@@ -1907,14 +1907,14 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
 		       "in feature `%s'.\n"),
 		     name, tdesc_feature_name (feature));
 	  tdesc_data_cleanup (tdesc_data_loc);
-	  return FALSE;
+	  return false;
 	}
     }
 
   *tdesc = tdesc_loc;
   *tdesc_data = tdesc_data_loc;
 
-  return TRUE;
+  return true;
 }
 
 /* Implement the type_align gdbarch function.  */
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 0/7] minor boolification
@ 2019-05-04 20:14 Tom Tromey
  2019-05-04 20:11 ` [FYI 2/7] Change valid_command_p to return bool Tom Tromey
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:14 UTC (permalink / raw)
  To: gdb-patches

I noticed a few spots using TRUE or FALSE.  This patch changes them to
use the C++ spellings instead.

There are still places using the upper-case forms, primarily in the
TUI and in the Windows code.

Tested by the buildbot.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 6/7] Use gdb_assert_not_reached in arm-linux-nat.c
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
                   ` (5 preceding siblings ...)
  2019-05-04 20:14 ` [FYI 1/7] Change valid_user_defined_cmd_name_p " Tom Tromey
@ 2019-05-04 20:14 ` Tom Tromey
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes arm-linux-nat.c to use gdb_assert_not_reached rather than
an assert of false.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* arm-linux-nat.c (arm_linux_nat_target::can_use_hw_breakpoint):
	Use gdb_assert_not_reached.
---
 gdb/ChangeLog       | 5 +++++
 gdb/arm-linux-nat.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 52668da9fcf..c86c97d895a 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -690,7 +690,7 @@ arm_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
 	return -1;
     }
   else
-    gdb_assert (FALSE);
+    gdb_assert_not_reached ("unknown breakpoint type");
 
   return 1;
 }
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [FYI 1/7] Change valid_user_defined_cmd_name_p to return bool
  2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
                   ` (4 preceding siblings ...)
  2019-05-04 20:12 ` [FYI 7/7] Change arc_tdesc_init to return bool Tom Tromey
@ 2019-05-04 20:14 ` Tom Tromey
  2019-05-04 20:14 ` [FYI 6/7] Use gdb_assert_not_reached in arm-linux-nat.c Tom Tromey
  6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2019-05-04 20:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes valid_user_defined_cmd_name_p to return bool.

gdb/ChangeLog
2019-05-04  Tom Tromey  <tom@tromey.com>

	* cli/cli-decode.c (valid_user_defined_cmd_name_p): Return bool.
	* command.h (valid_user_defined_cmd_name_p): Channge return type.
---
 gdb/ChangeLog        | 5 +++++
 gdb/cli/cli-decode.c | 8 ++++----
 gdb/command.h        | 2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 50430953c72..72e2a970097 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1328,13 +1328,13 @@ find_command_name_length (const char *text)
    This is a stricter subset of all gdb commands,
    see find_command_name_length.  */
 
-int
+bool
 valid_user_defined_cmd_name_p (const char *name)
 {
   const char *p;
 
   if (*name == '\0')
-    return FALSE;
+    return false;
 
   /* Alas "42" is a legitimate user-defined command.
      In the interests of not breaking anything we preserve that.  */
@@ -1346,10 +1346,10 @@ valid_user_defined_cmd_name_p (const char *name)
 	  || *p == '_')
 	; /* Ok.  */
       else
-	return FALSE;
+	return false;
     }
 
-  return TRUE;
+  return true;
 }
 
 /* This routine takes a line of TEXT and a CLIST in which to start the
diff --git a/gdb/command.h b/gdb/command.h
index 4a239a71965..35006cc339e 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -133,7 +133,7 @@ extern struct cli_suppress_notification cli_suppress_notification;
 
 /* API to the manipulation of command lists.  */
 
-extern int valid_user_defined_cmd_name_p (const char *name);
+extern bool valid_user_defined_cmd_name_p (const char *name);
 
 /* Const-correct variant of the above.  */
 
-- 
2.17.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-04 20:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-04 20:14 [FYI 0/7] minor boolification Tom Tromey
2019-05-04 20:11 ` [FYI 2/7] Change valid_command_p to return bool Tom Tromey
2019-05-04 20:11 ` [FYI 3/7] Use "false" in select_frame_for_mi Tom Tromey
2019-05-04 20:11 ` [FYI 4/7] Use bool, true, and false in arc-tdep.c Tom Tromey
2019-05-04 20:11 ` [FYI 5/7] Use "false" in compile_cplus_convert_enum Tom Tromey
2019-05-04 20:12 ` [FYI 7/7] Change arc_tdesc_init to return bool Tom Tromey
2019-05-04 20:14 ` [FYI 1/7] Change valid_user_defined_cmd_name_p " Tom Tromey
2019-05-04 20:14 ` [FYI 6/7] Use gdb_assert_not_reached in arm-linux-nat.c Tom Tromey

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).