diff options
author | Pedro Alves <palves@redhat.com> | 2016-04-22 16:40:33 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-04-22 16:40:33 +0100 |
commit | b3f11165aad39586cca0352ed5fe32b721699c76 (patch) | |
tree | ad558eff00c2bdc9d3d75a1adc2d5397b98e5cbc /gdb/go-exp.y | |
parent | 6290672f89d5638a9da5ce10b2f4ba793dcc6396 (diff) | |
download | gdb-b3f11165aad39586cca0352ed5fe32b721699c76.zip gdb-b3f11165aad39586cca0352ed5fe32b721699c76.tar.gz gdb-b3f11165aad39586cca0352ed5fe32b721699c76.tar.bz2 |
Centralize yacc interface names remapping (yyparse, yylex, yyerror, etc)
This factors out all the yy-variables remapping to a single file,
instead of each parser having to do the same, with different prefixes.
With this, a parser just needs to define the prefix they want and
include yy-remap.h, which does the dirty job.
Note this renames the c_error, ada_error, etc. functions. Writing the
remapping pattern as:
#define yyerror GDB_YY_REMAP (error)
instead of:
#define yyerror GDB_YY_REMAP (yyerror)
would have avoided the renaming. However, that would be problematic
if we have a macro 'foo' in scope, when we write:
#define yyfoo GDB_YY_REMAP (foo)
as that would expand 'foo'.
The c_yyerror etc. naming end ups indicating that this is a yacc
related function more clearly, so feels like a good change, anyway.
gdb/ChangeLog:
2016-04-22 Pedro Alves <palves@redhat.com>
* ada-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* ada-lang.c (ada_language_defn): Adjust.
* ada-lang.h (ada_error): Rename to ...
(ada_yyerror): ... this.
* c-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Adjust.
* c-lang.h (c_error): Rename to ...
(c_yyerror): ... this.
* d-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* d-lang.c (d_language_defn): Adjust.
* d-lang.h (d_error): Rename to ...
(d_yyerror): ... this.
* f-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* f-lang.c (f_language_defn): Adjust.
* f-lang.h (f_error): Rename to ...
(f_yyerror): ... this.
* go-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* go-lang.c (go_language_defn): Adjust.
* go-lang.h (go_error): Rename to ...
(go_yyerror): ... this.
* jv-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* jv-lang.c (java_language_defn): Adjust.
* jv-lang.h (java_error): Rename to ...
(java_yyerror): ... this.
* m2-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* m2-lang.c (m2_language_defn): Adjust.
* m2-lang.h (m2_error): Rename to ...
(m2_yyerror): ... this.
* objc-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* objc-lang.c (objc_language_defn): Adjust.
* opencl-lang.c (opencl_language_defn): Adjust.
* p-exp.y: Remove all yy symbol remappings.
(GDB_YY_REMAP_PREFIX): Define.
Include "yy-remap.h".
* p-lang.c (pascal_language_defn): Adjust.
* p-lang.h (pascal_error): Rename to ...
(pascal_yyerror): ... this.
* yy-remap.h: New file.
Diffstat (limited to 'gdb/go-exp.y')
-rw-r--r-- | gdb/go-exp.y | 57 |
1 files changed, 4 insertions, 53 deletions
diff --git a/gdb/go-exp.y b/gdb/go-exp.y index c4ea0f0..1b0fe5b 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -67,59 +67,10 @@ #define parse_type(ps) builtin_type (parse_gdbarch (ps)) -/* 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 go_maxdepth -#define yyparse go_parse_internal -#define yylex go_lex -#define yyerror go_error -#define yylval go_lval -#define yychar go_char -#define yydebug go_debug -#define yypact go_pact -#define yyr1 go_r1 -#define yyr2 go_r2 -#define yydef go_def -#define yychk go_chk -#define yypgo go_pgo -#define yyact go_act -#define yyexca go_exca -#define yyerrflag go_errflag -#define yynerrs go_nerrs -#define yyps go_ps -#define yypv go_pv -#define yys go_s -#define yy_yys go_yys -#define yystate go_state -#define yytmp go_tmp -#define yyv go_v -#define yy_yyv go_yyv -#define yyval go_val -#define yylloc go_lloc -#define yyreds go_reds /* With YYDEBUG defined */ -#define yytoks go_toks /* With YYDEBUG defined */ -#define yyname go_name /* With YYDEBUG defined */ -#define yyrule go_rule /* With YYDEBUG defined */ -#define yylhs go_yylhs -#define yylen go_yylen -#define yydefred go_yydefred -#define yydgoto go_yydgoto -#define yysindex go_yysindex -#define yyrindex go_yyrindex -#define yygindex go_yygindex -#define yytable go_yytable -#define yycheck go_yycheck - -#ifndef YYDEBUG -#define YYDEBUG 1 /* Default to yydebug support */ -#endif - -#define YYFPRINTF parser_fprintf +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX go_ +#include "yy-remap.h" /* The state of the parser, used internally when we are parsing the expression. */ |