diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-12-17 11:21:08 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2018-12-24 17:25:25 +0000 |
commit | b6c95c0cc5bd60e2de86d611120bf6191f99860a (patch) | |
tree | 4cd57b303235fe96a7abf855b1646b8e4abc18ad /gdb | |
parent | 45b8ae0c3348a6e6aa64ad5d114adabdc399c5ef (diff) | |
download | gdb-b6c95c0cc5bd60e2de86d611120bf6191f99860a.zip gdb-b6c95c0cc5bd60e2de86d611120bf6191f99860a.tar.gz gdb-b6c95c0cc5bd60e2de86d611120bf6191f99860a.tar.bz2 |
gdb: Extend the comments in c-exp.y
In an attempt to fix PR gdb/13368 this commit adds some comments to
c-exp.y which hopefully makes the type parsing code a little clearer.
There are no code changes here, so there should be no user visible
changes after this commit.
gdb/ChangeLog:
PR gdb/13368
* c-exp.y (typebase): Extend the comment.
(ident_tokens): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/c-exp.y | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 21731be..ced5180 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-12-24 Andrew Burgess <andrew.burgess@embecosm.com> + + PR gdb/13368 + * c-exp.y (typebase): Extend the comment. + (ident_tokens): Likewise. + 2018-12-18 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_find_containing_comp_unit): Don't take diff --git a/gdb/c-exp.y b/gdb/c-exp.y index bfc7841..447ac78 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1224,7 +1224,17 @@ func_mod: '(' ')' type : ptype ; -typebase /* Implements (approximately): (type-qualifier)* type-specifier */ +/* Implements (approximately): (type-qualifier)* type-specifier. + + When type-specifier is only ever a single word, like 'float' then these + arrive as pre-built TYPENAME tokens thanks to the classify_name + function. However, when a type-specifier can contain multiple words, + for example 'double' can appear as just 'double' or 'long double', and + similarly 'long' can appear as just 'long' or in 'long double', then + these type-specifiers are parsed into their own tokens in the function + lex_one_token and the ident_tokens array. These separate tokens are all + recognised here. */ +typebase : TYPENAME { $$ = $1.type; } | INT_KEYWORD @@ -2323,7 +2333,10 @@ static const struct token tokentab2[] = {".*", DOT_STAR, BINOP_END, FLAG_CXX} }; -/* Identifier-like tokens. */ +/* Identifier-like tokens. Only type-specifiers than can appear in + multi-word type names (for example 'double' can appear in 'long + double') need to be listed here. type-specifiers that are only ever + single word (like 'float') are handled by the classify_name function. */ static const struct token ident_tokens[] = { {"unsigned", UNSIGNED, OP_NULL, 0}, |