From patchwork Mon Jan 7 22:08:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 30995 Received: (qmail 97239 invoked by alias); 7 Jan 2019 22:09:08 -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 96814 invoked by uid 89); 7 Jan 2019 22:09:07 -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, MIME_BASE64_BLANKS autolearn=ham version=3.3.2 spammy=D*ac.uk, John, 2757, LETTER X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Jan 2019 22:09:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1546898941; x=1549490941; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8MQcfBTVYt/w4kqyUxaR1kKNbWZAL9MFJUYOjzX8Aa4=; b=GnOvem1AoEFBEx40p9Bo51M3K1E2fVhILxyj/SROhQgjyarRzO0xcXF9qpbBzLAF xAMmQCnSysEeMq4xPPrNenCBeQLQ03WsKh+fqMkcSp5sg0pCWmRGbOak/oHf64us oh1uk91NiFI1m8ZNL5NboYGnOl2QXaJzvbRcYWPIUc8=; Received: from ESESSMB505.ericsson.se (Unknown_Domain [153.88.183.123]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 74.6A.13660.DFDC33C5; Mon, 7 Jan 2019 23:09:01 +0100 (CET) Received: from ESESSMR501.ericsson.se (153.88.183.108) by ESESSMB505.ericsson.se (153.88.183.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 7 Jan 2019 23:09:01 +0100 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMR501.ericsson.se (153.88.183.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 7 Jan 2019 23:09:01 +0100 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 7 Jan 2019 23:09:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8MQcfBTVYt/w4kqyUxaR1kKNbWZAL9MFJUYOjzX8Aa4=; b=XP20h04FAfxUTEhz73Oq6f/MXpWIkX4c5S6I1Gxc4YxhMbbtIPJDSuhPJ+IyJ+li0d8VCT/tRdlWEWjEgTlg2xDpgmF8WNjIbCSXXURYpWVsMq8z5kXHHGJgjOQhEAUpPqr08qSm3vLKqxgrMWdlAzHGC/kwOhhSVZ+enp4hvq8= Received: from BYAPR15MB2390.namprd15.prod.outlook.com (52.135.198.30) by BYAPR15MB3045.namprd15.prod.outlook.com (20.178.238.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Mon, 7 Jan 2019 22:08:58 +0000 Received: from BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::a4b4:ea6a:6321:191e]) by BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::a4b4:ea6a:6321:191e%3]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 22:08:58 +0000 From: Simon Marchi To: John Marshall , "gdb-patches@sourceware.org" CC: Tom Tromey Subject: Re: [PATCH] Fix build failure with macOS bison Date: Mon, 7 Jan 2019 22:08:58 +0000 Message-ID: <7dd4f695-ec03-5cd7-47ec-7caf1a5f4414@ericsson.com> References: <12BBB509-646E-4140-ACB8-856A453E5646@glasgow.ac.uk> <051D67D6-A7D8-4A6F-A54E-501051C2D4BA@glasgow.ac.uk> In-Reply-To: <051D67D6-A7D8-4A6F-A54E-501051C2D4BA@glasgow.ac.uk> authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Content-ID: <50023F4D0C07004492443FCFC4F5D93D@namprd15.prod.outlook.com> MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com X-IsSubscribed: yes On 2019-01-07 11:14 a.m., John Marshall wrote: > On 7 Jan 2019, at 15:38, John Marshall wrote: >> Tom Tromey wrote: >>> Simon -- I can't readily try this patch on macOS right now, so I was >>> hoping you could. >> >> I have independently done the same bisection as in gdb/24060 (should have looked at the list archives more carefully first!), and can confirm that this patch fixes c-exp.y. However the same problem occurs for f-exp.y (and perhaps others). > > Problem exists in c-exp.y, f-exp.y, and p-exp.y. The others have avoided this (probably mostly by luck) by naming their similar thing DOLLAR_VARIABLE (d-exp.y and go-exp.y) or other similar names. > > John > Indeed. Since other files already use the name DOLLAR_VARIABLE, I suggest using it too. I went a bit further and changed other .y files too, so they use a consistent name. Tom, are you ok with this? From a2ac953450b79b460064ebc717d54c5d896b69c2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 6 Jan 2019 09:49:11 -0700 Subject: [PATCH] Fix build failure with macOS bison PR gdb/24060 points out a compilation failure of the C, Fortran and Pascal parsers when they are built using the macOS system bison. The bug is a name clash between the VARIABLE token name and the VARIABLE enumerator in ui-out.h. This patch renames VARIABLE in c-exp.y, f-exp.y and p-exp.y to DOLLAR_VARIABLE to avoid the clash. It also renames similar variables in other .y files so that all languages use the same name. gdb/ChangeLog 2019-01-07 Tom Tromey 2019-01-07 Simon Marchi PR gdb/24060: * ada-exp.y (DOLLAR_VARIABLE): Rename from SPECIAL_VARIABLE. * ada-lex.l (DOLLAR_VARIABLE): Likewise. * c-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE. * f-exp.y (DOLLAR_VARIABLE): Likewise. * m2-exp.y (DOLLAR_VARIABLE): Rename from INTERNAL_VAR. * p-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE. --- gdb/ada-exp.y | 4 ++-- gdb/ada-lex.l | 2 +- gdb/c-exp.y | 8 ++++---- gdb/f-exp.y | 6 +++--- gdb/m2-exp.y | 6 +++--- gdb/p-exp.y | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) -- 2.20.1 diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 5342e6b2b70..5925416e88f 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -151,7 +151,7 @@ static struct type *type_system_address (struct parser_state *); /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token SPECIAL_VARIABLE +%token DOLLAR_VARIABLE %nonassoc ASSIGN %left _AND_ OR XOR THEN ELSE @@ -275,7 +275,7 @@ primary : var_or_type %prec VAR } ; -primary : SPECIAL_VARIABLE /* Various GDB extensions */ +primary : DOLLAR_VARIABLE /* Various GDB extensions */ { write_dollar_variable (pstate, $1); } ; diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 95ea92e12d4..05af013c258 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -290,7 +290,7 @@ false { return FALSEKEYWORD; } "$"({LETTER}|{DIG}|"$")* { yylval.sval.ptr = yytext; yylval.sval.length = yyleng; - return SPECIAL_VARIABLE; + return DOLLAR_VARIABLE; } /* CATCH-ALL ERROR CASE */ diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 155fe09f37a..f3ef23c75a7 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -234,7 +234,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value); legal basetypes. */ %token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD -%token VARIABLE +%token DOLLAR_VARIABLE %token ASSIGN_MODIFY @@ -798,7 +798,7 @@ exp : FLOAT exp : variable ; -exp : VARIABLE +exp : DOLLAR_VARIABLE { write_dollar_variable (pstate, $1); } @@ -2884,7 +2884,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name) } if (*tokstart == '$') - return VARIABLE; + return DOLLAR_VARIABLE; if (parse_completion && *lexptr == '\0') saw_name_at_eof = 1; @@ -3337,7 +3337,7 @@ c_print_token (FILE *file, int type, YYSTYPE value) break; case NSSTRING: - case VARIABLE: + case DOLLAR_VARIABLE: parser_fprintf (file, "sval<%s>", copy_name (value.sval)); break; diff --git a/gdb/f-exp.y b/gdb/f-exp.y index ae6f86a34be..d70c66474c0 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -161,7 +161,7 @@ static int parse_number (struct parser_state *, const char *, int, %token BOOL_AND BOOL_OR BOOL_NOT %token CHARACTER -%token VARIABLE +%token DOLLAR_VARIABLE %token ASSIGN_MODIFY @@ -426,7 +426,7 @@ exp : FLOAT exp : variable ; -exp : VARIABLE +exp : DOLLAR_VARIABLE ; exp : SIZEOF '(' type ')' %prec UNARY @@ -1135,7 +1135,7 @@ yylex (void) if (*tokstart == '$') { write_dollar_variable (pstate, yylval.sval); - return VARIABLE; + return DOLLAR_VARIABLE; } /* Use token-type TYPENAME for symbols that happen to be defined diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index a0394916172..85d587651a2 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -125,7 +125,7 @@ static int number_sign = 1; /* The GDB scope operator */ %token COLONCOLON -%token INTERNAL_VAR +%token DOLLAR_VARIABLE /* M2 tokens */ %left ',' @@ -535,7 +535,7 @@ variable: fblock ; /* GDB internal ($foo) variable */ -variable: INTERNAL_VAR +variable: DOLLAR_VARIABLE ; /* GDB scope operator */ @@ -949,7 +949,7 @@ yylex (void) if (*tokstart == '$') { write_dollar_variable (pstate, yylval.sval); - return INTERNAL_VAR; + return DOLLAR_VARIABLE; } /* Use token-type BLOCKNAME for symbols that happen to be defined as diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 7e2769e33ca..31e8c4bea66 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -158,7 +158,7 @@ static int search_field; /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token VARIABLE +%token DOLLAR_VARIABLE /* Object pascal */ @@ -521,7 +521,7 @@ exp : FLOAT exp : variable ; -exp : VARIABLE +exp : DOLLAR_VARIABLE /* Already written by write_dollar_variable. Handle current_type. */ { if (intvar) { @@ -1492,7 +1492,7 @@ yylex (void) tmp[namelen] = '\0'; intvar = lookup_only_internalvar (tmp + 1); free (uptokstart); - return VARIABLE; + return DOLLAR_VARIABLE; } /* Use token-type BLOCKNAME for symbols that happen to be defined as