]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Rearrange block.c to avoid a forward declaration
authorTom Tromey <tom@tromey.com>
Tue, 17 Jan 2023 00:04:55 +0000 (17:04 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 19 Feb 2023 19:51:05 +0000 (12:51 -0700)
Moving block_initialize_namespace before its callers lets us avoid a
forward declaration.

gdb/block.c

index 167cb08e0bb5dcf887083165cc901d052e59f8e9..751f67d30f72decf7197dd15539d6f857e87f51a 100644 (file)
@@ -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.  */