]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove make_function_type
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 17 Dec 2025 15:54:59 +0000 (10:54 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 6 Jan 2026 19:59:15 +0000 (14:59 -0500)
We now have make_function_type and lookup_function_type exposed by
gdbtypes.h, which do essentially the same thing.  Remove
make_function_type, inlining its code inside create_function_type.
Change all other callers of make_function_type to use
lookup_function_type instead.

Change-Id: Id7c25f02059efe5c0f15e8ab8a35ac1fa97d9d6a
Approved-By: Tom Tromey <tom@tromey.com>
gdb/avr-tdep.c
gdb/ft32-tdep.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/z80-tdep.c

index 1263dafbf51b0d9306240edca7747b6b26296ca0..fe0283f1b48a23ace8506f9352d2f0d7941dc62c 100644 (file)
@@ -1475,7 +1475,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      be defined.  */
   type_allocator alloc (gdbarch);
   tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
-  tdep->func_void_type = make_function_type (tdep->void_type);
+  tdep->func_void_type = lookup_function_type (tdep->void_type);
   tdep->pc_type = init_pointer_type (alloc, 4 * TARGET_CHAR_BIT, NULL,
                                     tdep->func_void_type);
 
index 64bd79a660ad261cdf38487e8781034a0d79c679..84b9ce657cba6266ef261874ba2c738692adc286 100644 (file)
@@ -576,7 +576,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      be defined.  */
   type_allocator alloc (gdbarch);
   void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
-  func_void_type = make_function_type (void_type);
+  func_void_type = lookup_function_type (void_type);
   tdep->pc_type = init_pointer_type (alloc, 4 * TARGET_CHAR_BIT, NULL,
                                     func_void_type);
   tdep->pc_type->set_instance_flags (tdep->pc_type->instance_flags ()
index 30efaa1e9045ec920dbe42770fb5b32ed10559ea..aa27f717e38fdfe459144246f34ebf8b185d7024 100644 (file)
@@ -476,22 +476,6 @@ lookup_rvalue_reference_type (struct type *type)
   return lookup_reference_type (type, TYPE_CODE_RVALUE_REF);
 }
 
-/* See gdbtypes.h.  */
-
-type *
-make_function_type (type *return_type)
-{
-  type *ntype = type_allocator (return_type).new_type ();
-
-  ntype->set_target_type (return_type);
-  ntype->set_length (1);
-  ntype->set_code (TYPE_CODE_FUNC);
-
-  INIT_FUNC_SPECIFIC (ntype);
-
-  return ntype;
-}
-
 /* Given a return type and argument types, create new function type.
    If the final type in PARAM_TYPES is NULL, create a varargs function.
    New type is allocated using ALLOC.  */
@@ -499,7 +483,13 @@ make_function_type (type *return_type)
 static type *
 create_function_type (type *return_type, int nparams, type **param_types)
 {
-  type *fn = make_function_type (return_type);
+  type *fn = type_allocator (return_type).new_type ();
+
+  fn->set_target_type (return_type);
+  fn->set_length (1);
+  fn->set_code (TYPE_CODE_FUNC);
+
+  INIT_FUNC_SPECIFIC (fn);
 
   if (nparams > 0)
     {
index 11793dd59d29ac3ccb740c744d6efdc73e9d5c9c..4afc1968c6c657463fe768f2c86f957df8d4d3e7 100644 (file)
@@ -2518,10 +2518,6 @@ extern type *make_pointer_type (type *type);
 
 extern struct type *lookup_pointer_type (struct type *);
 
-/* Lookup a function type that returns type RETURN_TYPE.  */
-
-extern struct type *make_function_type (type *return_type);
-
 /* Create a new function type with return type RETURN_TYPE and unspecified
    number and types of parameters.
 
index e6f29276536854601e2d416b628f76696648f19d..b304b7764c26ba150258445076dffe7d9404ace0 100644 (file)
@@ -1142,7 +1142,7 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   type_allocator alloc (gdbarch);
   tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT,
                                    "void");
-  tdep->func_void_type = make_function_type (tdep->void_type);
+  tdep->func_void_type = lookup_function_type (tdep->void_type);
   tdep->pc_type = init_pointer_type (alloc,
                                     tdep->addr_length * TARGET_CHAR_BIT,
                                     NULL, tdep->func_void_type);