From patchwork Wed May 30 14:29:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27566 Received: (qmail 20684 invoked by alias); 30 May 2018 14:30:02 -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 20515 invoked by uid 89); 30 May 2018 14:30:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (50.116.125.2) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 May 2018 14:29:59 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 2371B400D0E60 for ; Wed, 30 May 2018 09:29:58 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id O26wfcGaPPvAdO26wfqOsF; Wed, 30 May 2018 09:29:58 -0500 X-Authority-Reason: nr=8 Received: from 75-166-42-107.hlrn.qwest.net ([75.166.42.107]:33690 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fO26v-001nlR-T7; Wed, 30 May 2018 09:29:58 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/5] Use yy-remap.h in cp-name-parser.y Date: Wed, 30 May 2018 08:29:50 -0600 Message-Id: <20180530142953.24934-3-tom@tromey.com> In-Reply-To: <20180530142953.24934-1-tom@tromey.com> References: <20180530142953.24934-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fO26v-001nlR-T7 X-Source-Sender: 75-166-42-107.hlrn.qwest.net (bapiya.Home) [75.166.42.107]:33690 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This changes cp-name-parser.y to use yy-remap.h, rather than its old manual approach. This required declaring parser_fprintf in cp-name-parser.y. parser-defs.h can't be included here because parser-defs.h declares a global "lexptr", which conflicts with the local one in cp-name-parser.y. This is only temporary, and will be cleaned up later in the series. 2018-05-30 Tom Tromey * cp-name-parser.y (parser_fprintf): Declare. (GDB_YY_REMAP_PREFIX): Define. Include yy-remap.h. Don't redefine yy* identifiers. --- gdb/ChangeLog | 6 +++++ gdb/cp-name-parser.y | 62 +++++++--------------------------------------------- 2 files changed, 14 insertions(+), 54 deletions(-) diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 3e1c9d9e6f0..043f311cc0e 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -37,6 +37,14 @@ #include "cp-support.h" #include "c-support.h" +/* Function used to avoid direct calls to fprintf + in the code generated by the bison parser. */ + +extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); + +#define GDB_YY_REMAP_PREFIX cpname +#include "yy-remap.h" + /* Bison does not make it easy to create a parser without global state, unfortunately. Here are all the global variables used in this parser. */ @@ -118,60 +126,6 @@ static struct demangle_component *d_binary (const char *, #define INT_SIGNED (1 << 4) #define INT_UNSIGNED (1 << 5) -/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), - as well as gratuitiously global symbol names, so we can have multiple - yacc generated parsers in gdb. Note that these are only the variables - produced by yacc. If other parser generators (bison, byacc, etc) produce - additional global names that conflict at link time, then those parser - generators need to be fixed instead of adding those names to this list. */ - -#define yymaxdepth cpname_maxdepth -#define yyparse cpname_parse -#define yylex cpname_lex -#define yyerror cpname_error -#define yylval cpname_lval -#define yychar cpname_char -#define yydebug cpname_debug -#define yypact cpname_pact -#define yyr1 cpname_r1 -#define yyr2 cpname_r2 -#define yydef cpname_def -#define yychk cpname_chk -#define yypgo cpname_pgo -#define yyact cpname_act -#define yyexca cpname_exca -#define yyerrflag cpname_errflag -#define yynerrs cpname_nerrs -#define yyps cpname_ps -#define yypv cpname_pv -#define yys cpname_s -#define yy_yys cpname_yys -#define yystate cpname_state -#define yytmp cpname_tmp -#define yyv cpname_v -#define yy_yyv cpname_yyv -#define yyval cpname_val -#define yylloc cpname_lloc -#define yyreds cpname_reds /* With YYDEBUG defined */ -#define yytoks cpname_toks /* With YYDEBUG defined */ -#define yyname cpname_name /* With YYDEBUG defined */ -#define yyrule cpname_rule /* With YYDEBUG defined */ -#define yylhs cpname_yylhs -#define yylen cpname_yylen -#define yydefred cpname_yydefred -#define yydgoto cpname_yydgoto -#define yysindex cpname_yysindex -#define yyrindex cpname_yyrindex -#define yygindex cpname_yygindex -#define yytable cpname_yytable -#define yycheck cpname_yycheck -#define yyss cpname_yyss -#define yysslim cpname_yysslim -#define yyssp cpname_yyssp -#define yystacksize cpname_yystacksize -#define yyvs cpname_yyvs -#define yyvsp cpname_yyvsp - int yyparse (void); static int yylex (void); static void yyerror (const char *);