diff options
author | Tom Tromey <tom@tromey.com> | 2020-03-14 12:11:42 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-03-14 12:32:10 -0600 |
commit | 3293bbaffac9a22fc6d1a08ac6602a4a63b5e68b (patch) | |
tree | 8d10f688849be05aea48fbc1a03ba602211f7133 /gdb/compile/compile-cplus-symbols.c | |
parent | ab44624cea74dca3e6d19c3275d9d5a8d381c084 (diff) | |
download | gdb-3293bbaffac9a22fc6d1a08ac6602a4a63b5e68b.zip gdb-3293bbaffac9a22fc6d1a08ac6602a4a63b5e68b.tar.gz gdb-3293bbaffac9a22fc6d1a08ac6602a4a63b5e68b.tar.bz2 |
Add C parser support for "restrict" and "_Atomic"
A user noticed that "watch -location" would fail with a "restrict"
pointer. The issue here is that if the DWARF mentions "restrict", gdb
will put this into the type name -- but then the C parser will not be
able to parse this type.
This patch adds support for "restrict" and "_Atomic" to the C parser.
C++ doesn't have "restrict", but does have some GCC extensions. The
type printer is changed to handle this difference as well, so that
watch expressions will work properly.
gdb/ChangeLog
2020-03-14 Tom Tromey <tom@tromey.com>
* c-typeprint.c (cp_type_print_method_args): Print "__restrict__"
for C++.
(c_type_print_modifier): Likewise. Add "language" parameter.
(c_type_print_varspec_prefix, c_type_print_base_struct_union)
(c_type_print_base_1): Update.
* type-stack.h (enum type_pieces) <tp_atomic, tp_restrict>: New
constants.
* type-stack.c (type_stack::insert): Handle tp_atomic and
tp_restrict.
(type_stack::follow_type_instance_flags): Likewise.
(type_stack::follow_types): Likewise. Merge type-following code.
* c-exp.y (RESTRICT, ATOMIC): New tokens.
(space_identifier, cv_with_space_id)
(const_or_volatile_or_space_identifier_noopt)
(const_or_volatile_or_space_identifier): Remove.
(single_qualifier, qualifier_seq_noopt, qualifier_seq): New
rules.
(ptr_operator, typebase): Update.
(enum token_flag) <FLAG_C>: New constant.
(ident_tokens): Add "restrict", "__restrict__", "__restrict", and
"_Atomic".
(lex_one_token): Handle FLAG_C.
gdb/testsuite/ChangeLog
2020-03-14 Tom Tromey <tom@tromey.com>
* gdb.base/cvexpr.exp: Add test for _Atomic and restrict.
Diffstat (limited to 'gdb/compile/compile-cplus-symbols.c')
0 files changed, 0 insertions, 0 deletions