From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 4923E3858D20; Sun, 19 Feb 2023 23:36:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4923E3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676849819; bh=Z3V1n1uWy18BfWJ8zbJIGbO8mwnczpXOd6a0O9lAJRU=; h=From:To:Subject:Date:From; b=tzWaDuuU0rBbULHh06mMI0jr6ESDFUuNjm8YvtOMToceZ0I95//dbFI2qZ8zoXWqd LNaJitFUyN9UjYkJBOGLRFeX1tp/UPpamk3gcSMkWrbH7zefD09vbjfNN1ov2HC1qh 4i/ErBrAN5iCt88jQk5aqRj56moK57U1aTrPdf74= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Rearrange block.c to avoid a forward declaration X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 0ea8d78bd3ff77499e9d7c19d7a40cea680e89de X-Git-Newrev: 4aabc4166430fed52e9a2e4042147e3480f9178a Message-Id: <20230219233659.4923E3858D20@sourceware.org> Date: Sun, 19 Feb 2023 23:36:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4aabc4166430= fed52e9a2e4042147e3480f9178a commit 4aabc4166430fed52e9a2e4042147e3480f9178a Author: Tom Tromey Date: Mon Jan 16 17:04:55 2023 -0700 Rearrange block.c to avoid a forward declaration =20 Moving block_initialize_namespace before its callers lets us avoid a forward declaration. Diff: --- gdb/block.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 167cb08e0bb..751f67d30f7 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -37,9 +37,6 @@ struct block_namespace_info : public allocate_on_obstack struct using_direct *using_decl =3D nullptr; }; =20 -static void block_initialize_namespace (struct block *block, - struct obstack *obstack); - /* See block.h. */ =20 struct objfile * @@ -305,6 +302,16 @@ block_scope (const struct block *block) return ""; } =20 +/* 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_info () =3D=3D NULL) + block->set_namespace_info (new (obstack) struct block_namespace_info (= )); +} + /* Set BLOCK's scope member to SCOPE; if needed, allocate memory via OBSTACK. (It won't make a copy of SCOPE, however, so that already has to be allocated correctly.) */ @@ -344,16 +351,6 @@ block_set_using (struct block *block, block->namespace_info ()->using_decl =3D using_decl; } =20 -/* 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_info () =3D=3D NULL) - block->set_namespace_info (new (obstack) struct block_namespace_info (= )); -} - /* Return the static block associated to BLOCK. Return NULL if block is NULL or if block is a global block. */