[binutils-gdb] Remove context_stack::depth

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f00b143cc80ba47e513c6a4b8acaed08a2a779b6

commit f00b143cc80ba47e513c6a4b8acaed08a2a779b6
Author: Tom Tromey <[email protected]>
Date:   Wed Apr 15 11:39:36 2026 -0600

    Remove context_stack::depth
    
    context_stack::depth is never used, and I think it's not really
    useful, so this removes it.
    
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/buildsym.c    |  7 +++----
 gdb/buildsym.h    | 10 +++-------
 gdb/dwarf2/read.c |  4 ++--
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 4156cd72100..0746717b014 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -924,17 +924,16 @@ buildsym_compunit::augment_type_symtab ()
     }
 }
 
-/* Push a context block.  Args are an identifying nesting level
-   (checkable when you pop it), and the starting PC address of this
+/* Push a context block.  VALU is the starting PC address of this
    context.  */
 
 context_stack &
-buildsym_compunit::push_context (int desc, CORE_ADDR valu)
+buildsym_compunit::push_context (CORE_ADDR valu)
 {
   context_stack &ctx
     = m_context_stack.emplace_back (std::move (m_local_symbols),
 				    m_local_using_directives,
-				    m_pending_blocks, valu, desc);
+				    m_pending_blocks, valu);
 
   m_local_using_directives = nullptr;
 
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 06d8d3c691f..70d22229f53 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -74,12 +74,11 @@ using subfile_up = std::unique_ptr<subfile>;
 struct context_stack
 {
   context_stack (std::vector<symbol *> locals, using_direct *local_using_directives,
-		 pending_block *old_blocks, CORE_ADDR start_addr, int depth)
+		 pending_block *old_blocks, CORE_ADDR start_addr)
     : locals (std::move (locals)),
       local_using_directives (local_using_directives),
       old_blocks (old_blocks),
-      start_addr (start_addr),
-      depth (depth)
+      start_addr (start_addr)
   {}
 
   /* Outer locals at the time we entered.  */
@@ -96,9 +95,6 @@ struct context_stack
 
   /* PC where this context starts.  */
   CORE_ADDR start_addr;
-
-  /* For error-checking matching push/pop.  */
-  int depth;
 };
 
 /* Flags associated with a linetable entry.  */
@@ -245,7 +241,7 @@ struct buildsym_compunit
     m_producer = producer;
   }
 
-  context_stack &push_context (int desc, CORE_ADDR valu);
+  context_stack &push_context (CORE_ADDR valu);
 
   context_stack pop_context ();
 
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index beb1a440f1b..c4601fee391 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7803,7 +7803,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     }
 
   gdb_assert (cu->get_builder () != nullptr);
-  context_stack &ctx = cu->get_builder ()->push_context (0, lowpc);
+  context_stack &ctx = cu->get_builder ()->push_context (lowpc);
   ctx.name = new_symbol (die, read_type_die (die, cu), cu, templ_func);
 
   if (dwarf2_func_is_main_p (die, cu))
@@ -7955,7 +7955,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
   lowpc = per_objfile->relocate (unrel_low);
   highpc = per_objfile->relocate (unrel_high);
 
-  cu->get_builder ()->push_context (0, lowpc);
+  cu->get_builder ()->push_context (lowpc);
   for (die_info *child_die : die->children ())
     process_die (child_die, cu);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.