public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Rearrange block.c to avoid a forward declaration
Date: Sun, 19 Feb 2023 23:36:59 +0000 (GMT)	[thread overview]
Message-ID: <20230219233659.4923E3858D20@sourceware.org> (raw)

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

commit 4aabc4166430fed52e9a2e4042147e3480f9178a
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Jan 16 17:04:55 2023 -0700

    Rearrange block.c to avoid a forward declaration
    
    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 = nullptr;
 };
 
-static void block_initialize_namespace (struct block *block,
-					struct obstack *obstack);
-
 /* See block.h.  */
 
 struct objfile *
@@ -305,6 +302,16 @@ block_scope (const struct block *block)
   return "";
 }
 
+/* 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 () == 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 = using_decl;
 }
 
-/* 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 () == 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.  */

                 reply	other threads:[~2023-02-19 23:36 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=20230219233659.4923E3858D20@sourceware.org \
    --to=tromey@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).