[2/2] Use bool in decode_line_2_item

Message ID 20250111-linespec-more-bool-v1-2-fd2213135450@tromey.com
State New
Headers
Series More use of bool in linespec |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Tom Tromey Jan. 11, 2025, 6:53 p.m. UTC
  This changes decode_line_2_item::selected to bool.  There was no
benefit to keeping this as a bitfield, so I removed that.  Note that
the constructor already uses bool here.
---
 gdb/linespec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gdb/linespec.c b/gdb/linespec.c
index b3b7b418ec427a1e31495ede706e518b1c344340..9b820d860d820972cfd49774382985e547834fd9 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1378,9 +1378,8 @@  struct decode_line_2_item
   /* The form using symtab_to_filename_for_display.  */
   std::string displayform;
 
-  /* Field is initialized to zero and it is set to one if the user
-     requested breakpoint for this entry.  */
-  unsigned int selected : 1;
+  /* True if the user requested breakpoint for this entry.  */
+  bool selected;
 };
 
 /* Handle multiple results in RESULT depending on SELECT_MODE.  This
@@ -1495,7 +1494,7 @@  decode_line_2 (struct linespec_state *self,
 	  if (!item->selected)
 	    {
 	      filters.push_back (item->fullform.c_str ());
-	      item->selected = 1;
+	      item->selected = true;
 	    }
 	  else
 	    {