aboutsummaryrefslogtreecommitdiff
path: root/gdb/m2-exp.y
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-04-22 16:40:33 +0100
committerPedro Alves <palves@redhat.com>2016-04-22 16:40:33 +0100
commitb3f11165aad39586cca0352ed5fe32b721699c76 (patch)
treead558eff00c2bdc9d3d75a1adc2d5397b98e5cbc /gdb/m2-exp.y
parent6290672f89d5638a9da5ce10b2f4ba793dcc6396 (diff)
downloadgdb-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/m2-exp.y')
-rw-r--r--gdb/m2-exp.y63
1 files changed, 4 insertions, 59 deletions
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index a527440..a8b431e 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -51,65 +51,10 @@
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
#define parse_m2_type(ps) builtin_m2_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 m2_maxdepth
-#define yyparse m2_parse_internal
-#define yylex m2_lex
-#define yyerror m2_error
-#define yylval m2_lval
-#define yychar m2_char
-#define yydebug m2_debug
-#define yypact m2_pact
-#define yyr1 m2_r1
-#define yyr2 m2_r2
-#define yydef m2_def
-#define yychk m2_chk
-#define yypgo m2_pgo
-#define yyact m2_act
-#define yyexca m2_exca
-#define yyerrflag m2_errflag
-#define yynerrs m2_nerrs
-#define yyps m2_ps
-#define yypv m2_pv
-#define yys m2_s
-#define yy_yys m2_yys
-#define yystate m2_state
-#define yytmp m2_tmp
-#define yyv m2_v
-#define yy_yyv m2_yyv
-#define yyval m2_val
-#define yylloc m2_lloc
-#define yyreds m2_reds /* With YYDEBUG defined */
-#define yytoks m2_toks /* With YYDEBUG defined */
-#define yyname m2_name /* With YYDEBUG defined */
-#define yyrule m2_rule /* With YYDEBUG defined */
-#define yylhs m2_yylhs
-#define yylen m2_yylen
-#define yydefred m2_yydefred
-#define yydgoto m2_yydgoto
-#define yysindex m2_yysindex
-#define yyrindex m2_yyrindex
-#define yygindex m2_yygindex
-#define yytable m2_yytable
-#define yycheck m2_yycheck
-#define yyss m2_yyss
-#define yysslim m2_yysslim
-#define yyssp m2_yyssp
-#define yystacksize m2_yystacksize
-#define yyvs m2_yyvs
-#define yyvsp m2_yyvsp
-
-#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 m2_
+#include "yy-remap.h"
/* The state of the parser, used internally when we are parsing the
expression. */