X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fparse.c;h=42fccc67924967f1978b3b4ca0f0162efe08cc04;hb=63b5bc2fef8801f01fd14786f7893d86fa5e92ee;hp=64966edf2b5aa543f5a9decda9619a8196cb6a44;hpb=2e2394a07543257fba6f8ba89a74ed316a2b9f09;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/parse.c b/gdb/parse.c index 64966edf2b..42fccc6792 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1208,8 +1208,8 @@ parse_expression (char *string) /* Stuff for maintaining a stack of types. Currently just used by C, but probably useful for any language which declares its types "backwards". */ -void -push_type (enum type_pieces tp) +static void +check_type_stack_depth (void) { if (type_stack_depth == type_stack_size) { @@ -1217,21 +1217,28 @@ push_type (enum type_pieces tp) type_stack = (union type_stack_elt *) xrealloc ((char *) type_stack, type_stack_size * sizeof (*type_stack)); } +} + +void +push_type (enum type_pieces tp) +{ + check_type_stack_depth (); type_stack[type_stack_depth++].piece = tp; } void push_type_int (int n) { - if (type_stack_depth == type_stack_size) - { - type_stack_size *= 2; - type_stack = (union type_stack_elt *) - xrealloc ((char *) type_stack, type_stack_size * sizeof (*type_stack)); - } + check_type_stack_depth (); type_stack[type_stack_depth++].int_val = n; } +void +push_type_address_space (char *string) +{ + push_type_int (address_space_name_to_int (string)); +} + enum type_pieces pop_type (void) { @@ -1257,6 +1264,7 @@ follow_types (struct type *follow_type) int done = 0; int make_const = 0; int make_volatile = 0; + int make_addr_space = 0; int array_size; struct type *range_type; @@ -1273,6 +1281,11 @@ follow_types (struct type *follow_type) follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile, follow_type, 0); + if (make_addr_space) + follow_type = make_type_with_address_space (follow_type, + make_addr_space); + make_const = make_volatile = 0; + make_addr_space = 0; break; case tp_const: make_const = 1; @@ -1280,6 +1293,9 @@ follow_types (struct type *follow_type) case tp_volatile: make_volatile = 1; break; + case tp_space_identifier: + make_addr_space = pop_type_int (); + break; case tp_pointer: follow_type = lookup_pointer_type (follow_type); if (make_const) @@ -1290,15 +1306,27 @@ follow_types (struct type *follow_type) follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile, follow_type, 0); + if (make_addr_space) + follow_type = make_type_with_address_space (follow_type, + make_addr_space); make_const = make_volatile = 0; + make_addr_space = 0; break; case tp_reference: follow_type = lookup_reference_type (follow_type); if (make_const) - follow_type = make_cv_type (make_const, TYPE_VOLATILE (follow_type), follow_type, 0); + follow_type = make_cv_type (make_const, + TYPE_VOLATILE (follow_type), + follow_type, 0); if (make_volatile) - follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile, follow_type, 0); + follow_type = make_cv_type (TYPE_CONST (follow_type), + make_volatile, + follow_type, 0); + if (make_addr_space) + follow_type = make_type_with_address_space (follow_type, + make_addr_space); make_const = make_volatile = 0; + make_addr_space = 0; break; case tp_array: array_size = pop_type_int ();