]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove make_pointer_type typeptr parameter
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 6 Jan 2026 19:59:07 +0000 (14:59 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 6 Jan 2026 19:59:14 +0000 (14:59 -0500)
It is always nullptr.

Change-Id: I88e81427c781bd6356203ccc969eae1ab84ac0ef
Approved-By: Tom Tromey <tom@tromey.com>
gdb/break-catch-throw.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c

index 11169065403e5eea517f01a0c18fd219f61cb18a..03d8c5f772dfc547f93dbda851949c04da3eeaa9 100644 (file)
@@ -481,7 +481,7 @@ compute_exception (struct gdbarch *argc, struct internalvar *var, void *ignore)
      the std::type_info for the exception.  Now we find the type from
      the type_info and cast the result.  */
   obj_type = cplus_type_from_type_info (arg1);
-  return value_ind (value_cast (make_pointer_type (obj_type, NULL), arg0));
+  return value_ind (value_cast (make_pointer_type (obj_type), arg0));
 }
 
 /* Implementation of the '$_exception' variable.  */
index 5aa85b8800ec23a2fe3d8bb2b285ac99e9a72571..a70d6a9cc55f2a9c8da35173cca4195f322bc5cd 100644 (file)
@@ -360,13 +360,10 @@ smash_type (struct type *type)
   /* For now, leave the pointer/reference types alone.  */
 }
 
-/* Lookup a pointer to a type TYPE.  TYPEPTR, if nonzero, points
-   to a pointer to memory where the pointer type should be stored.
-   If *TYPEPTR is zero, update it to point to the pointer type we return.
-   We allocate new memory if needed.  */
+/* See gdbtypes.h.  */
 
-struct type *
-make_pointer_type (struct type *type, struct type **typeptr)
+type *
+make_pointer_type (type *type)
 {
   struct type *ntype;  /* New type */
   struct type *chain;
@@ -374,31 +371,9 @@ make_pointer_type (struct type *type, struct type **typeptr)
   ntype = TYPE_POINTER_TYPE (type);
 
   if (ntype)
-    {
-      if (typeptr == 0)
-       return ntype;           /* Don't care about alloc,
-                                  and have new type.  */
-      else if (*typeptr == 0)
-       {
-         *typeptr = ntype;     /* Tracking alloc, and have new type.  */
-         return ntype;
-       }
-    }
-
-  if (typeptr == 0 || *typeptr == 0)   /* We'll need to allocate one.  */
-    {
-      ntype = type_allocator (type).new_type ();
-      if (typeptr)
-       *typeptr = ntype;
-    }
-  else                 /* We have storage, but need to reset it.  */
-    {
-      ntype = *typeptr;
-      chain = TYPE_CHAIN (ntype);
-      smash_type (ntype);
-      TYPE_CHAIN (ntype) = chain;
-    }
+    return ntype;
 
+  ntype = type_allocator (type).new_type ();
   ntype->set_target_type (type);
   TYPE_POINTER_TYPE (type) = ntype;
 
@@ -429,7 +404,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
 struct type *
 lookup_pointer_type (struct type *type)
 {
-  return make_pointer_type (type, (struct type **) 0);
+  return make_pointer_type (type);
 }
 
 /* Lookup a C++ `reference' to a type TYPE.  TYPEPTR, if nonzero,
index 0f2e5a0fc13fbe1a7b7b9592459287a9bbd86186..c454ddcf8195ffa5ec25c9abd312eda6d64f3d47 100644 (file)
@@ -2511,7 +2511,9 @@ extern struct_elt lookup_struct_elt (struct type *, const char *, int);
 
 extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
 
-extern struct type *make_pointer_type (struct type *, struct type **);
+/* Lookup a pointer to a type TYPE.  */
+
+extern type *make_pointer_type (type *type);
 
 extern struct type *lookup_pointer_type (struct type *);
 
index 87ab0e8535305be3f29d0e7e42effb0f56fed2aa..14a2d1cc75d767a4c8f5839b247fe73ba7f9b0d0 100644 (file)
@@ -1003,7 +1003,7 @@ build_std_type_info_type (struct gdbarch *arch)
   struct type *char_type
     = builtin_type (arch)->builtin_char;
   struct type *char_ptr_type
-    = make_pointer_type (make_cv_type (1, 0, char_type, NULL), NULL);
+    = make_pointer_type (make_cv_type (1, 0, char_type, NULL));
 
   t = type_allocator (arch).new_type (TYPE_CODE_STRUCT, 0, nullptr);
 
@@ -1120,7 +1120,7 @@ gnuv3_get_typeid (struct value *value)
        error (_("cannot find typeinfo for object of type '%s'"),
               name);
       typeinfo_value = value_field (vtable, vtable_field_type_info);
-      result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
+      result = value_ind (value_cast (make_pointer_type (typeinfo_type),
                                      typeinfo_value));
     }
   else