From: Simon Marchi Date: Tue, 6 Jan 2026 19:59:07 +0000 (-0500) Subject: gdb: remove make_pointer_type typeptr parameter X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8652a334f91397b16b76fff70bbccafb9c559d02;p=thirdparty%2Fbinutils-gdb.git gdb: remove make_pointer_type typeptr parameter It is always nullptr. Change-Id: I88e81427c781bd6356203ccc969eae1ab84ac0ef Approved-By: Tom Tromey --- diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index 11169065403..03d8c5f772d 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -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. */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 5aa85b8800e..a70d6a9cc55 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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, diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 0f2e5a0fc13..c454ddcf819 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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 *); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 87ab0e85353..14a2d1cc75d 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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