public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gdb/linespec.c: simplify condition
@ 2021-12-03 21:35 Simon Marchi
  2021-12-03 21:35 ` [PATCH 2/2] gdb: make struct linespect contain vectors, not pointers to vectors Simon Marchi
  2021-12-07 19:32 ` [PATCH 1/2] gdb/linespec.c: simplify condition Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Marchi @ 2021-12-03 21:35 UTC (permalink / raw)
  To: gdb-patches

We can remove the empty check: if the vector has size 1, it is obviously
not empty.  This code ended up like this because the empty check used to
be a NULL check.

Change-Id: I1571bd0228818ca93f6a6b444e9b010dc2da4c08
---
 gdb/linespec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 56bfaede9d9a..44134665ac7c 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2085,8 +2085,7 @@ canonicalize_linespec (struct linespec_state *state, const linespec *ls)
       if (explicit_loc->function_name == NULL)
 	{
 	  /* No function was specified, so add the symbol name.  */
-	  gdb_assert (!ls->labels.function_symbols->empty ()
-		      && (ls->labels.function_symbols->size () == 1));
+	  gdb_assert (ls->labels.function_symbols->size () == 1);
 	  block_symbol s = ls->labels.function_symbols->front ();
 	  explicit_loc->function_name = xstrdup (s.symbol->natural_name ());
 	}
-- 
2.33.1


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

end of thread, other threads:[~2021-12-08  3:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 21:35 [PATCH 1/2] gdb/linespec.c: simplify condition Simon Marchi
2021-12-03 21:35 ` [PATCH 2/2] gdb: make struct linespect contain vectors, not pointers to vectors Simon Marchi
2021-12-07 19:35   ` Tom Tromey
2021-12-08  3:24     ` Simon Marchi
2021-12-07 19:32 ` [PATCH 1/2] gdb/linespec.c: simplify condition Tom Tromey
2021-12-07 20:59   ` Simon Marchi

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