aboutsummaryrefslogtreecommitdiff
path: root/binutils/wrstabs.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-04-29 09:17:05 +0930
committerAlan Modra <amodra@gmail.com>2019-04-30 22:04:32 +0930
commit8107ddcea1da07f1c4e902c17f045684beb78079 (patch)
tree0af9356c84cbd77dc78706b422a11ff51a8da3d8 /binutils/wrstabs.c
parent06ddcada14d90c4da28f9585801aaae48304d8ea (diff)
downloadgdb-8107ddcea1da07f1c4e902c17f045684beb78079.zip
gdb-8107ddcea1da07f1c4e902c17f045684beb78079.tar.gz
gdb-8107ddcea1da07f1c4e902c17f045684beb78079.tar.bz2
Work around gcc9 warning bug
* wrstabs.c (stab_start_class_type): Add assert to work around gcc9 warning. Tidy.
Diffstat (limited to 'binutils/wrstabs.c')
-rw-r--r--binutils/wrstabs.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c
index 3d1839f..3e941dc 100644
--- a/binutils/wrstabs.c
+++ b/binutils/wrstabs.c
@@ -1440,18 +1440,15 @@ stab_end_struct_type (void *p)
/* Start outputting a class. */
static bfd_boolean
-stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size, bfd_boolean vptr, bfd_boolean ownvptr)
+stab_start_class_type (void *p, const char *tag, unsigned int id,
+ bfd_boolean structp, unsigned int size,
+ bfd_boolean vptr, bfd_boolean ownvptr)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- bfd_boolean definition;
- char *vstring;
+ bfd_boolean definition = FALSE;
+ char *vstring = NULL;
- if (! vptr || ownvptr)
- {
- definition = FALSE;
- vstring = NULL;
- }
- else
+ if (vptr && !ownvptr)
{
definition = info->type_stack->definition;
vstring = stab_pop_type (info);
@@ -1472,17 +1469,16 @@ stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean st
}
else
{
+ assert (vstring);
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
+ if (definition)
+ info->type_stack->definition = TRUE;
}
-
info->type_stack->vtable = vtable;
}
- if (definition)
- info->type_stack->definition = TRUE;
-
return TRUE;
}