/* Language independent support for printing types for GDB, the GNU debugger.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
This file is part of GDB.
static hashval_t
hash_typedef_field (const void *p)
{
- const struct typedef_field *tf = p;
+ const struct typedef_field *tf = (const struct typedef_field *) p;
struct type *t = check_typedef (tf->type);
return htab_hash_string (TYPE_SAFE_NAME (t));
static int
eq_typedef_field (const void *a, const void *b)
{
- const struct typedef_field *tfa = a;
- const struct typedef_field *tfb = b;
+ const struct typedef_field *tfa = (const struct typedef_field *) a;
+ const struct typedef_field *tfb = (const struct typedef_field *) b;
return types_equal (tfa->type, tfb->type);
}
static void
do_free_typedef_hash (void *arg)
{
- free_typedef_hash (arg);
+ free_typedef_hash ((struct typedef_hash_table *) arg);
}
/* Return a new cleanup that frees TABLE. */
static int
copy_typedef_hash_element (void **slot, void *nt)
{
- htab_t new_table = nt;
+ htab_t new_table = (htab_t) nt;
void **new_slot;
new_slot = htab_find_slot (new_table, *slot, INSERT);
static void
do_free_global_table (void *arg)
{
- struct type_print_options *flags = arg;
+ struct type_print_options *flags = (struct type_print_options *) arg;
free_typedef_hash (flags->global_typedefs);
free_ext_lang_type_printers (flags->global_printers);
slot = htab_find_slot (flags->global_typedefs->table, &tf, INSERT);
if (*slot != NULL)
{
- new_tf = *slot;
+ new_tf = (struct typedef_field *) *slot;
return new_tf->name;
}
if (applied != NULL)
{
- new_tf->name = obstack_copy0 (&flags->global_typedefs->storage, applied,
- strlen (applied));
+ new_tf->name
+ = (const char *) obstack_copy0 (&flags->global_typedefs->storage,
+ applied, strlen (applied));
xfree (applied);
}
tf.name = NULL;
tf.type = t;
- found = htab_find (flags->local_typedefs->table, &tf);
+ found = (struct typedef_field *) htab_find (flags->local_typedefs->table,
+ &tf);
if (found != NULL)
return found->name;
/* Print TYPE to a string, returning it. The caller is responsible for
freeing the string. */
-char *
+std::string
type_to_string (struct type *type)
{
- char *s = NULL;
+ std::string s;
struct ui_file *stb;
struct cleanup *old_chain;
TRY
{
type_print (type, "", stb, -1);
- s = ui_file_xstrdup (stb, NULL);
+ s = ui_file_as_string (stb);
}
CATCH (except, RETURN_MASK_ALL)
{
- s = NULL;
}
END_CATCH
static void
whatis_exp (char *exp, int show)
{
- struct expression *expr;
struct value *val;
struct cleanup *old_chain;
struct type *real_type = NULL;
struct type *type;
int full = 0;
- int top = -1;
+ LONGEST top = -1;
int using_enc = 0;
struct value_print_options opts;
struct type_print_options flags = default_ptype_flags;
exp = skip_spaces (exp);
}
- expr = parse_expression (exp);
- make_cleanup (free_current_contents, &expr);
- val = evaluate_type (expr);
+ expression_up expr = parse_expression (exp);
+ val = evaluate_type (expr.get ());
}
else
val = access_value_history (0);
unsigned int i;
unsigned len;
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
switch (TYPE_CODE (type))
{
{
struct value *val;
struct type *type;
- struct cleanup *old_chain;
- struct expression *expr;
if (type_name != NULL)
{
- expr = parse_expression (type_name);
- old_chain = make_cleanup (free_current_contents, &expr);
+ expression_up expr = parse_expression (type_name);
if (expr->elts[0].opcode == OP_TYPE)
{
/* The user expression names a type directly, just use that type. */
{
/* The user expression may name a type indirectly by naming an
object of that type. Find that indirectly named type. */
- val = evaluate_type (expr);
+ val = evaluate_type (expr.get ());
type = value_type (val);
}
if (type != NULL)
{
recursive_dump_type (type, 0);
}
- do_cleanups (old_chain);
}
}
\f
show_print_type_typedefs,
&setprinttypelist, &showprinttypelist);
}
+
+/* Print <not allocated> status to stream STREAM. */
+
+void
+val_print_not_allocated (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<not allocated>"));
+}
+
+/* Print <not associated> status to stream STREAM. */
+
+void
+val_print_not_associated (struct ui_file *stream)
+{
+ fprintf_filtered (stream, _("<not associated>"));
+}
+