diff options
author | Michael Snyder <msnyder@vmware.com> | 2001-09-27 22:39:05 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2001-09-27 22:39:05 +0000 |
commit | 2e2394a07543257fba6f8ba89a74ed316a2b9f09 (patch) | |
tree | 6f31ddc0dab7e34780ab313e40e1c732eba4fd52 /gdb/parse.c | |
parent | 9b28427211134b5f480ea863b42bb2da8a52f18f (diff) | |
download | gdb-2e2394a07543257fba6f8ba89a74ed316a2b9f09.zip gdb-2e2394a07543257fba6f8ba89a74ed316a2b9f09.tar.gz gdb-2e2394a07543257fba6f8ba89a74ed316a2b9f09.tar.bz2 |
2001-09-20 Michael Snyder <msnyder@redhat.com>
Changes by Daniel Berlin <dan@cgsoftware.com>, to support
better parsing of const and volatile type expressions.
* c-exp.y (const_and_volatile, const_or_volatile_noopt,
const_or_volatile): New non-terminals.
(ptype): Use new rule for const_or_volatile.
(typebase): Use new rule for const_or_volatile_noopt.
* parser-defs.h (enum type_pieces): New values tp_const, tp_volatile.
* parse.c (follow_types): Handle tp_const and tp_volatile on the
type stack: call make_cv_type to create new const/volatile type.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r-- | gdb/parse.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index 1c4324b..64966ed 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1255,6 +1255,8 @@ struct type * follow_types (struct type *follow_type) { int done = 0; + int make_const = 0; + int make_volatile = 0; int array_size; struct type *range_type; @@ -1263,12 +1265,40 @@ follow_types (struct type *follow_type) { case tp_end: done = 1; + if (make_const) + 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); + break; + case tp_const: + make_const = 1; + break; + case tp_volatile: + make_volatile = 1; break; case tp_pointer: follow_type = lookup_pointer_type (follow_type); + if (make_const) + 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); + make_const = make_volatile = 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); + if (make_volatile) + follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile, follow_type, 0); + make_const = make_volatile = 0; break; case tp_array: array_size = pop_type_int (); |