* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()

method of popping recursion-detection stack with a method based on
obstack_object_size().  (Similar to the PR9167 patch below, but for
the static array obstack rather than the static member obstack.)
This commit is contained in:
Chris Moller 2010-04-22 20:12:07 +00:00
parent 6cd6a2aec6
commit f56dcb8879
2 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2010-04-22 Chris Moller <cmoller@redhat.com>
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
method of popping recursion-detection stack with a method based on
obstack_object_size(). (Similar to the PR9167 patch below, but for
the static array obstack rather than the static member obstack.)
2010-04-22 H.J. Lu <hongjiu.lu@intel.com> 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Removed. * amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Removed.

View File

@ -186,18 +186,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
fprintf_filtered (stream, "<No data fields>"); fprintf_filtered (stream, "<No data fields>");
else else
{ {
int obstack_initial_size = 0; int statmem_obstack_initial_size = 0;
void *stat_array_obstack_top = NULL; int stat_array_obstack_initial_size = 0;
if (dont_print_statmem == 0) if (dont_print_statmem == 0)
{ {
obstack_initial_size = statmem_obstack_initial_size =
obstack_object_size (&dont_print_statmem_obstack); obstack_object_size (&dont_print_statmem_obstack);
if (last_set_recurse != recurse) if (last_set_recurse != recurse)
{ {
stat_array_obstack_top stat_array_obstack_initial_size =
= obstack_next_free (&dont_print_stat_array_obstack); obstack_object_size (&dont_print_stat_array_obstack);
last_set_recurse = recurse; last_set_recurse = recurse;
} }
} }
@ -323,12 +323,12 @@ cp_print_value_fields (struct type *type, struct type *real_type,
int obstack_final_size = int obstack_final_size =
obstack_object_size (&dont_print_statmem_obstack); obstack_object_size (&dont_print_statmem_obstack);
if (obstack_final_size > obstack_initial_size) { if (obstack_final_size > statmem_obstack_initial_size) {
/* In effect, a pop of the printed-statics stack. */ /* In effect, a pop of the printed-statics stack. */
void *free_to_ptr = void *free_to_ptr =
obstack_next_free (&dont_print_statmem_obstack) - obstack_next_free (&dont_print_statmem_obstack) -
(obstack_final_size - obstack_initial_size); (obstack_final_size - statmem_obstack_initial_size);
obstack_free (&dont_print_statmem_obstack, obstack_free (&dont_print_statmem_obstack,
free_to_ptr); free_to_ptr);
@ -336,9 +336,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
if (last_set_recurse != recurse) if (last_set_recurse != recurse)
{ {
if (obstack_object_size (&dont_print_stat_array_obstack) > 0) int obstack_final_size =
obstack_free (&dont_print_stat_array_obstack, obstack_object_size (&dont_print_stat_array_obstack);
stat_array_obstack_top);
if (obstack_final_size > stat_array_obstack_initial_size)
{
void *free_to_ptr =
obstack_next_free (&dont_print_stat_array_obstack) -
(obstack_final_size - stat_array_obstack_initial_size);
obstack_free (&dont_print_stat_array_obstack,
free_to_ptr);
}
last_set_recurse = -1; last_set_recurse = -1;
} }
} }