From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 1A43E3858C2C; Thu, 28 Apr 2022 02:39:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A43E3858C2C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove BLOCK_NAMESPACE macro X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 24d74bb5df30de096f0271d33ab4f17434cf2c49 X-Git-Newrev: 3fe38936f6c0fe5d724806a1646fb7b67638b420 Message-Id: <20220428023928.1A43E3858C2C@sourceware.org> Date: Thu, 28 Apr 2022 02:39:28 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 02:39:28 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D3fe38936f6c0= fe5d724806a1646fb7b67638b420 commit 3fe38936f6c0fe5d724806a1646fb7b67638b420 Author: Simon Marchi Date: Fri Jan 28 16:24:06 2022 -0500 gdb: remove BLOCK_NAMESPACE macro =20 Replace with equivalent methods. =20 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 !=3D NULL; block =3D block->superblock ()) { - if (BLOCK_NAMESPACE (block) !=3D NULL - && BLOCK_NAMESPACE (block)->scope !=3D NULL) - return BLOCK_NAMESPACE (block)->scope; + if (block->namespace_info () !=3D NULL + && block->namespace_info ()->scope !=3D NULL) + return block->namespace_info ()->scope; } =20 return ""; @@ -315,7 +315,7 @@ block_set_scope (struct block *block, const char *scope, { block_initialize_namespace (block, obstack); =20 - BLOCK_NAMESPACE (block)->scope =3D scope; + block->namespace_info ()->scope =3D scope; } =20 /* This returns the using directives list associated with BLOCK, if @@ -324,10 +324,10 @@ block_set_scope (struct block *block, const char *sco= pe, struct using_direct * block_using (const struct block *block) { - if (block =3D=3D NULL || BLOCK_NAMESPACE (block) =3D=3D NULL) + if (block =3D=3D NULL || block->namespace_info () =3D=3D NULL) return NULL; else - return BLOCK_NAMESPACE (block)->using_decl; + return block->namespace_info ()->using_decl; } =20 /* 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); =20 - BLOCK_NAMESPACE (block)->using_decl =3D using_decl; + block->namespace_info ()->using_decl =3D using_decl; } =20 -/* 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. */ =20 static void block_initialize_namespace (struct block *block, struct obstack *obstack) { - if (BLOCK_NAMESPACE (block) =3D=3D NULL) - BLOCK_NAMESPACE (block) =3D new (obstack) struct block_namespace_info = (); + if (block->namespace_info () =3D=3D NULL) + block->set_namespace_info (new (obstack) struct block_namespace_info (= )); } =20 /* 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 =3D multidict; } =20 + /* 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 =3D namespace_info; } + /* Addresses in the executable code that are in this block. */ =20 CORE_ADDR m_start; @@ -155,7 +163,7 @@ struct block /* Contains information about namespace-related info relevant to this bl= ock: using directives and the current namespace scope. */ =20 - struct block_namespace_info *namespace_info; + struct block_namespace_info *m_namespace_info; =20 /* 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; }; =20 -#define BLOCK_NAMESPACE(bl) (bl)->namespace_info - /* Accessor for ranges field within block BL. */ =20 #define BLOCK_RANGES(bl) (bl)->ranges