public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb: remove BLOCK_NAMESPACE macro
Date: Thu, 28 Apr 2022 02:39:28 +0000 (GMT)	[thread overview]
Message-ID: <20220428023928.1A43E3858C2C@sourceware.org> (raw)

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


                 reply	other threads:[~2022-04-28  2:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220428023928.1A43E3858C2C@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).