From 02e12e3806bc60f66e3c446c4dfa9c06a400e604 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 2 Jan 2019 19:12:32 -0700 Subject: Use std::vector in type stacks This removes the use of VEC from parse.c and, at the same time, removes some related cleanups from c-exp.y. gdb/ChangeLog 2019-01-06 Tom Tromey * parser-defs.h (type_ptr): Remove typedef. Don't declare VEC. (union type_stack_elt) : Now a pointer to std::vector. (type_stack_cleanup): Don't declare. (push_typelist): Update. * parse.c (pop_typelist): Return a std::vector. (push_typelist): Take a std::vector. (follow_types): Update. Do not free args. (type_stack_cleanup): Remove. * c-exp.y (struct c_parse_state): New. (cpstate): New global. (type_aggregate_p, exp, ptr_operator, parameter_typelist) (nonempty_typelist): Update. (func_mod): Create a new vector. (c_parse): Create a c_parse_state. (check_parameter_typelist): Do not delete params. (function_method): Update. Do not delete type_list. --- gdb/parser-defs.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'gdb/parser-defs.h') diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 195264f..5b38477 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -200,9 +200,6 @@ struct objc_class_str int theclass; }; -typedef struct type *type_ptr; -DEF_VEC_P (type_ptr); - /* For parsing of complicated types. An array should be preceded in the list by the size of the array. */ enum type_pieces @@ -225,7 +222,7 @@ union type_stack_elt enum type_pieces piece; int int_val; struct type_stack *stack_val; - VEC (type_ptr) *typelist_val; + std::vector *typelist_val; }; /* The type stack is an instance of this structure. */ @@ -303,9 +300,7 @@ extern struct type_stack *append_type_stack (struct type_stack *to, extern void push_type_stack (struct type_stack *stack); -extern void type_stack_cleanup (void *arg); - -extern void push_typelist (VEC (type_ptr) *typelist); +extern void push_typelist (std::vector *typelist); extern int dump_subexp (struct expression *, struct ui_file *, int); -- cgit v1.1