[RFA,13/22] Remove unnecessary cleanup from stabsread.c
Commit Message
This removes an unnecessary cleanup from stabsread.c. It's
unnecessary because nothing between the cleanup creation and use makes
a cleanup.
2016-09-26 Tom Tromey <tom@tromey.com>
* stabsread.c (read_struct_type): Remove unnecessary cleanup.
---
gdb/ChangeLog | 4 ++++
gdb/stabsread.c | 9 +--------
2 files changed, 5 insertions(+), 8 deletions(-)
Comments
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> This removes an unnecessary cleanup from stabsread.c. It's
Tom> unnecessary because nothing between the cleanup creation and use makes
Tom> a cleanup.
I think this turns out to be incorrect, because read_struct_type calls
some functions that leave dangling cleanups. So, I'm dropping this
patch from the series.
Tom
On 09/27/2016 05:08 AM, Tom Tromey wrote:
> This removes an unnecessary cleanup from stabsread.c. It's
> unnecessary because nothing between the cleanup creation and use makes
> a cleanup.
>
> 2016-09-26 Tom Tromey <tom@tromey.com>
>
> * stabsread.c (read_struct_type): Remove unnecessary cleanup.
OK. Go ahead and push.
Thanks,
Pedro Alves
@@ -1,5 +1,9 @@
2016-09-26 Tom Tromey <tom@tromey.com>
+ * stabsread.c (read_struct_type): Remove unnecessary cleanup.
+
+2016-09-26 Tom Tromey <tom@tromey.com>
+
* tracepoint.c (trace_dump_command): Remove unnecessary
null_cleanup.
@@ -3507,7 +3507,6 @@ static struct type *
read_struct_type (char **pp, struct type *type, enum type_code type_code,
struct objfile *objfile)
{
- struct cleanup *back_to;
struct field_info fi;
fi.list = NULL;
@@ -3533,8 +3532,6 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
return type;
}
- back_to = make_cleanup (null_cleanup, 0);
-
INIT_CPLUS_SPECIFIC (type);
TYPE_CODE (type) = type_code;
TYPE_STUB (type) = 0;
@@ -3546,10 +3543,7 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
TYPE_LENGTH (type) = read_huge_number (pp, 0, &nbits, 0);
if (nbits != 0)
- {
- do_cleanups (back_to);
- return error_type (pp, objfile);
- }
+ return error_type (pp, objfile);
set_length_in_type_chain (type);
}
@@ -3568,7 +3562,6 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code,
type = error_type (pp, objfile);
}
- do_cleanups (back_to);
return (type);
}