Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>,	Simon Marchi <simark@simark.ca>,
	jimw@sifive.com,	jhb@FreeBSD.org,	palmer@sifive.com,
	Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCHv2 1/4] gdb: Extend the comments in c-exp.y
Date: Tue, 18 Dec 2018 22:40:00 -0000	[thread overview]
Message-ID: <55c3aab37c9193e6f8b999b19ddf9f30d917f042.1545172667.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1545172667.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1545172667.git.andrew.burgess@embecosm.com>

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.
---
 gdb/ChangeLog |  6 ++++++
 gdb/c-exp.y   | 17 +++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index bfc78415b22..447ac78eee1 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},
-- 
2.14.5


  parent reply	other threads:[~2018-12-18 22:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 23:25 [PATCH] gdb: Allow struct fields named double Andrew Burgess
2018-12-16 16:23 ` Simon Marchi
2018-12-16 16:42   ` Tom Tromey
2018-12-18 22:40     ` [PATCHv2 4/4] " Andrew Burgess
2018-12-21 17:19       ` Tom Tromey
2018-12-18 22:40     ` [PATCHv2 2/4] gdb: Resolve 49 reduce/reduce conflicts in c-exp.y Andrew Burgess
2018-12-21 16:37       ` Tom Tromey
2018-12-18 22:40     ` [PATCHv2 0/4] gdb: Allow struct fields named double Andrew Burgess
2018-12-24 17:30       ` Andrew Burgess
2018-12-18 22:40     ` [PATCHv2 3/4] gdb: Add new parser rule for structure field names Andrew Burgess
2018-12-21 16:38       ` Tom Tromey
2018-12-18 22:40     ` Andrew Burgess [this message]
2018-12-21 15:44       ` [PATCHv2 1/4] gdb: Extend the comments in c-exp.y Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55c3aab37c9193e6f8b999b19ddf9f30d917f042.1545172667.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=jimw@sifive.com \
    --cc=palmer@sifive.com \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox