Re: GDB 6.5.90 available for testing (GDB 6.6 pre-release)

Mark Kettenis
2006-12-05T21:37:04Z

>
> Here's the patch I've been using for this. It'd be better to rework
> the way those functions use those obstacks, but...
>
> 2006-12-05 Jim Blandy <jimb@codesourcery.com>
>
> * cp-valprint.c (cp_print_value_fields, cp_print_value):
> Initialize tmp_obstack, to avoid warnings.
> * p-valprint.c (pascal_object_print_value_fields)
> (pascal_object_print_value): Same.

This is silly, at least if they are really unecessary. It's a bug in GCC
and should be fixed. I mean, GCC should get better at detecting this sort
of things; not give more false positives.

Markus, can you file a GCC bug report for this?

>
> diff -rN -u old-lval/gdb/cp-valprint.c new-lval/gdb/cp-valprint.c
> --- gdb/cp-valprint.c 2006-12-05 11:11:42.000000000 -0800
> +++ gdb/cp-valprint.c 2006-12-05 11:11:43.000000000 -0800
> @@ -269,6 +269,9 @@
> char *last_dont_print = obstack_next_free
> (&dont_print_statmem_obstack);
> int fields_seen = 0;
>
> + /* This isn't necessary, but it avoids compiler warnings. */
> + obstack_init (&tmp_obstack);
> +
> CHECK_TYPEDEF (type);
>
> fprintf_filtered (stream, "{");
> @@ -531,6 +534,9 @@
> int thisoffset;
> struct type *thistype;
>
> + /* This isn't necessary, but it avoids compiler warnings. */
> + obstack_init (&tmp_obstack);
> +
> if (dont_print_vb == 0)
> {
> /* If we're at top level, carve out a completely fresh
> diff -rN -u old-lval/gdb/p-valprint.c new-lval/gdb/p-valprint.c
> --- gdb/p-valprint.c 2006-12-05 11:11:42.000000000 -0800
> +++ gdb/p-valprint.c 2006-12-05 11:11:44.000000000 -0800
> @@ -756,6 +756,9 @@
> struct obstack tmp_obstack;
> char *last_dont_print = obstack_next_free
> (&dont_print_statmem_obstack);
>
> + /* This isn't necessary, but it avoids compiler warnings. */
> + obstack_init (&tmp_obstack);
> +
> CHECK_TYPEDEF (type);
>
> fprintf_filtered (stream, "{");
> @@ -927,6 +930,9 @@
> = (struct type **) obstack_next_free (&dont_print_vb_obstack);
> int i, n_baseclasses = TYPE_N_BASECLASSES (type);
>
> + /* This isn't necessary, but it avoids compiler warnings. */
> + obstack_init (&tmp_obstack);
> +
> if (dont_print_vb == 0)
> {
> /* If we're at top level, carve out a completely fresh
>
>