[RFA,13/22] Remove unnecessary cleanup from stabsread.c

Message ID 1474949330-4307-14-git-send-email-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Sept. 27, 2016, 4:08 a.m. UTC
  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 Tromey Sept. 30, 2016, 3:43 p.m. UTC | #1
>>>>> "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
  
Pedro Alves Oct. 9, 2016, 5:07 p.m. UTC | #2
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
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d3b8a45..476dbb3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index e8ebadd..cc2fef3 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -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);
 }