public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove BLOCK_NAMESPACE macro
@ 2022-04-28  2:39 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-04-28  2:39 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3fe38936f6c0fe5d724806a1646fb7b67638b420

commit 3fe38936f6c0fe5d724806a1646fb7b67638b420
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Jan 28 16:24:06 2022 -0500

    gdb: remove BLOCK_NAMESPACE macro
    
    Replace with equivalent methods.
    
    Change-Id: If86b8cbdfb0f52e22c929614cd53e73358bab76a

Diff:
---
 gdb/block.c | 20 ++++++++++----------
 gdb/block.h | 12 +++++++++---
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/gdb/block.c b/gdb/block.c
index 5a6282bd1a9..2d28f9de792 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -297,9 +297,9 @@ block_scope (const struct block *block)
 {
   for (; block != NULL; block = block->superblock ())
     {
-      if (BLOCK_NAMESPACE (block) != NULL
-	  && BLOCK_NAMESPACE (block)->scope != NULL)
-	return BLOCK_NAMESPACE (block)->scope;
+      if (block->namespace_info () != NULL
+	  && block->namespace_info ()->scope != NULL)
+	return block->namespace_info ()->scope;
     }
 
   return "";
@@ -315,7 +315,7 @@ block_set_scope (struct block *block, const char *scope,
 {
   block_initialize_namespace (block, obstack);
 
-  BLOCK_NAMESPACE (block)->scope = scope;
+  block->namespace_info ()->scope = scope;
 }
 
 /* This returns the using directives list associated with BLOCK, if
@@ -324,10 +324,10 @@ block_set_scope (struct block *block, const char *scope,
 struct using_direct *
 block_using (const struct block *block)
 {
-  if (block == NULL || BLOCK_NAMESPACE (block) == NULL)
+  if (block == NULL || block->namespace_info () == NULL)
     return NULL;
   else
-    return BLOCK_NAMESPACE (block)->using_decl;
+    return block->namespace_info ()->using_decl;
 }
 
 /* Set BLOCK's using member to USING; if needed, allocate memory via
@@ -341,17 +341,17 @@ block_set_using (struct block *block,
 {
   block_initialize_namespace (block, obstack);
 
-  BLOCK_NAMESPACE (block)->using_decl = using_decl;
+  block->namespace_info ()->using_decl = using_decl;
 }
 
-/* If BLOCK_NAMESPACE (block) is NULL, allocate it via OBSTACK and
+/* If block->namespace_info () is NULL, allocate it via OBSTACK and
    initialize its members to zero.  */
 
 static void
 block_initialize_namespace (struct block *block, struct obstack *obstack)
 {
-  if (BLOCK_NAMESPACE (block) == NULL)
-    BLOCK_NAMESPACE (block) = new (obstack) struct block_namespace_info ();
+  if (block->namespace_info () == NULL)
+    block->set_namespace_info (new (obstack) struct block_namespace_info ());
 }
 
 /* Return the static block associated to BLOCK.  Return NULL if block
diff --git a/gdb/block.h b/gdb/block.h
index d0ae2708095..2f71f3c8b21 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -130,6 +130,14 @@ struct block
   void set_multidict (multidictionary *multidict)
   { m_multidict = multidict; }
 
+  /* Return this block's namespace info.  */
+  block_namespace_info *namespace_info () const
+  { return m_namespace_info; }
+
+  /* Set this block's namespace info.  */
+  void set_namespace_info (block_namespace_info *namespace_info)
+  { m_namespace_info = namespace_info; }
+
   /* Addresses in the executable code that are in this block.  */
 
   CORE_ADDR m_start;
@@ -155,7 +163,7 @@ struct block
   /* Contains information about namespace-related info relevant to this block:
      using directives and the current namespace scope.  */
 
-  struct block_namespace_info *namespace_info;
+  struct block_namespace_info *m_namespace_info;
 
   /* Address ranges for blocks with non-contiguous ranges.  If this
      is NULL, then there is only one range which is specified by
@@ -178,8 +186,6 @@ struct global_block
   struct compunit_symtab *compunit_symtab;
 };
 
-#define BLOCK_NAMESPACE(bl)	(bl)->namespace_info
-
 /* Accessor for ranges field within block BL.  */
 
 #define BLOCK_RANGES(bl)	(bl)->ranges


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-28  2:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  2:39 [binutils-gdb] gdb: remove BLOCK_NAMESPACE macro 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).