From: Simon Marchi Date: Fri, 28 Jan 2022 21:24:06 +0000 (-0500) Subject: gdb: remove BLOCK_NAMESPACE macro X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fe38936f6c0fe5d724806a1646fb7b67638b420;p=binutils-gdb.git gdb: remove BLOCK_NAMESPACE macro Replace with equivalent methods. Change-Id: If86b8cbdfb0f52e22c929614cd53e73358bab76a --- 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