Use yy-remap.h in cp-name-parser.y
authorTom Tromey <tom@tromey.com>
Tue, 29 May 2018 18:20:09 +0000 (12:20 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 1 Jun 2018 16:46:48 +0000 (10:46 -0600)
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.

gdb/ChangeLog
2018-06-01  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (parser_fprintf): Declare.
(GDB_YY_REMAP_PREFIX): Define.
Include yy-remap.h.  Don't redefine yy* identifiers.

gdb/ChangeLog
gdb/cp-name-parser.y

index 960545b0476e54983573b096c6c82c7b82d14170..3a723a4f5c5b9df83f60e6325c9939068e9d29a7 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-01  Tom Tromey  <tom@tromey.com>
+
+       * cp-name-parser.y (parser_fprintf): Declare.
+       (GDB_YY_REMAP_PREFIX): Define.
+       Include yy-remap.h.  Don't redefine yy* identifiers.
+
 2018-06-01  Tom Tromey  <tom@tromey.com>
 
        * python/py-type.c (typy_legacy_template_argument): Update.
index 3e1c9d9e6f0f211f390df58dfcd6e782a055eb6d..043f311cc0e0510be1cebb25dbb442f3fff28cfa 100644 (file)
 #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 *);
This page took 0.032264 seconds and 4 git commands to generate.