From patchwork Tue Dec 18 22:40:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 30750 Received: (qmail 71593 invoked by alias); 18 Dec 2018 22:40:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 71471 invoked by uid 89); 18 Dec 2018 22:40:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:sk:host86-, Hx-spam-relays-external:sk:host86-, H*r:sk:host86-, H*Ad:U*jhb X-HELO: mail-wm1-f48.google.com Received: from mail-wm1-f48.google.com (HELO mail-wm1-f48.google.com) (209.85.128.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Dec 2018 22:40:25 +0000 Received: by mail-wm1-f48.google.com with SMTP id f81so4408500wmd.4 for ; Tue, 18 Dec 2018 14:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=L66StEtuFU8/RbtQsDr+58QYnmjL7FU9KpQK7NITnjs=; b=cbEPXvLgz5LCr989+2xFCdKchh47SoGKktZ2YY7g/k0u+stv6lp6sQcK2VACfwh8/1 X9YOq9+8DbgsGwLuNlK0/Gt2ejIjDqD9w/ZbfrYrBSbmlEhAguWbdv1gTrRYKKPk2/RQ MHxFK1YSvpgduIJ/eOUKt87Ck0uOy6cHUurumxDFxpGHhaQHPFiIlNzzfPcF1HYa7ocL PfU0qAiYKz2avVx/z5twyNmDoK1378zH5uWbBwXq9dW4YYtA+X9qK2GwigMugJoRXUJH 2smtoPErjczcPsIIq/Y/QjRvmgJWDW9U15FeIMG5Cgja4b3hHdaZABZhhxixlMhZ9ue9 Sopg== Return-Path: Received: from localhost (host86-156-236-210.range86-156.btcentralplus.com. [86.156.236.210]) by smtp.gmail.com with ESMTPSA id f187sm2830822wma.4.2018.12.18.14.40.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Dec 2018 14:40:22 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Tom Tromey , Simon Marchi , jimw@sifive.com, jhb@FreeBSD.org, palmer@sifive.com, Andrew Burgess Subject: [PATCHv2 1/4] gdb: Extend the comments in c-exp.y Date: Tue, 18 Dec 2018 22:40:10 +0000 Message-Id: <55c3aab37c9193e6f8b999b19ddf9f30d917f042.1545172667.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: <87tvjd4e54.fsf@tromey.com> X-IsSubscribed: yes 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},