Centralize yacc interface names remapping (yyparse, yylex, yyerror, etc)
authorPedro Alves <palves@redhat.com>
Fri, 22 Apr 2016 15:40:33 +0000 (16:40 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 22 Apr 2016 15:40:33 +0000 (16:40 +0100)
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.

28 files changed:
gdb/ChangeLog
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lang.h
gdb/c-exp.y
gdb/c-lang.c
gdb/c-lang.h
gdb/d-exp.y
gdb/d-lang.c
gdb/d-lang.h
gdb/f-exp.y
gdb/f-lang.c
gdb/f-lang.h
gdb/go-exp.y
gdb/go-lang.c
gdb/go-lang.h
gdb/jv-exp.y
gdb/jv-lang.c
gdb/jv-lang.h
gdb/m2-exp.y
gdb/m2-lang.c
gdb/m2-lang.h
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-exp.y
gdb/p-lang.c
gdb/p-lang.h
gdb/yy-remap.h [new file with mode: 0644]

index 828d3909eae5c84439ca08d3e5d233028831cde6..512344c1030ad8fd6e9f86bb28c29e2f9ff7aa32 100644 (file)
@@ -1,3 +1,61 @@
+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.
+
 2016-04-22  Pedro Alves  <palves@redhat.com>
 
        * common/common-exceptions.h (GDB_XCPT_TRY): Remove mention of
index a98bdbcedb1ee83a95772f00b105c5ae6a699257..0a33e10485a6be6cd41ff49b70f840bbc5fc11b0 100644 (file)
 
 #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.  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.  */
-
-/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
-   options.  I presume we are maintaining it to accommodate systems
-   without BISON?  (PNH) */
-
-#define        yymaxdepth ada_maxdepth
-/* ada_parse calls this after initialization */
-#define        yyparse ada_parse_internal
-#define        yylex   ada_lex
-#define        yyerror ada_error
-#define        yylval  ada_lval
-#define        yychar  ada_char
-#define        yydebug ada_debug
-#define        yypact  ada_pact
-#define        yyr1    ada_r1
-#define        yyr2    ada_r2
-#define        yydef   ada_def
-#define        yychk   ada_chk
-#define        yypgo   ada_pgo
-#define        yyact   ada_act
-#define        yyexca  ada_exca
-#define yyerrflag ada_errflag
-#define yynerrs        ada_nerrs
-#define        yyps    ada_ps
-#define        yypv    ada_pv
-#define        yys     ada_s
-#define        yy_yys  ada_yys
-#define        yystate ada_state
-#define        yytmp   ada_tmp
-#define        yyv     ada_v
-#define        yy_yyv  ada_yyv
-#define        yyval   ada_val
-#define        yylloc  ada_lloc
-#define yyreds ada_reds                /* With YYDEBUG defined */
-#define yytoks ada_toks                /* With YYDEBUG defined */
-#define yyname ada_name                /* With YYDEBUG defined */
-#define yyrule ada_rule                /* With YYDEBUG defined */
-#define yydefred ada_yydefred
-#define yyss   ada_yyss
-#define yysslim        ada_yysslim
-#define yyssp  ada_yyssp
-#define yystacksize ada_yystacksize
-#define yyvs   ada_yyvs
-#define yyvsp  ada_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 ada_
+#include "yy-remap.h"
 
 struct name_info {
   struct symbol *sym;
index d01660a29f90b4b7df8ed2fc32285d9d2919d538..412aa972caa1579b84c92c2543c40bc83b1575c0 100644 (file)
@@ -14056,7 +14056,7 @@ const struct language_defn ada_language_defn = {
   macro_expansion_no,
   &ada_exp_descriptor,
   parse,
-  ada_error,
+  ada_yyerror,
   resolve,
   ada_printchar,                /* Print a character constant */
   ada_printstr,                 /* Function to print string constant */
index 1480977f3b6d7c861da375ea254b30601803aabb..7de71eb99ed7488002e375831b027e091f6dd333 100644 (file)
@@ -159,7 +159,7 @@ extern int ada_get_field_index (const struct type *type,
 
 extern int ada_parse (struct parser_state *);    /* Defined in ada-exp.y */
 
-extern void ada_error (char *); /* Defined in ada-exp.y */
+extern void ada_yyerror (char *); /* Defined in ada-exp.y */
 
                         /* Defined in ada-typeprint.c */
 extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
index 9f2a229fafcb379ec42bbbdfc2d00188fd69dd56..29f672f54c8a6027e60f9dff6e597c20c8b36a56 100644 (file)
 
 #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 c_maxdepth
-#define        yyparse c_parse_internal
-#define        yylex   c_lex
-#define        yyerror c_error
-#define        yylval  c_lval
-#define        yychar  c_char
-#define        yydebug c_debug
-#define        yypact  c_pact  
-#define        yyr1    c_r1                    
-#define        yyr2    c_r2                    
-#define        yydef   c_def           
-#define        yychk   c_chk           
-#define        yypgo   c_pgo           
-#define        yyact   c_act           
-#define        yyexca  c_exca
-#define yyerrflag c_errflag
-#define yynerrs        c_nerrs
-#define        yyps    c_ps
-#define        yypv    c_pv
-#define        yys     c_s
-#define        yy_yys  c_yys
-#define        yystate c_state
-#define        yytmp   c_tmp
-#define        yyv     c_v
-#define        yy_yyv  c_yyv
-#define        yyval   c_val
-#define        yylloc  c_lloc
-#define yyreds c_reds          /* With YYDEBUG defined */
-#define yytoks c_toks          /* With YYDEBUG defined */
-#define yyname c_name          /* With YYDEBUG defined */
-#define yyrule c_rule          /* With YYDEBUG defined */
-#define yylhs  c_yylhs
-#define yylen  c_yylen
-#define yydefred c_yydefred
-#define yydgoto        c_yydgoto
-#define yysindex c_yysindex
-#define yyrindex c_yyrindex
-#define yygindex c_yygindex
-#define yytable         c_yytable
-#define yycheck         c_yycheck
-#define yyss   c_yyss
-#define yysslim        c_yysslim
-#define yyssp  c_yyssp
-#define yystacksize c_yystacksize
-#define yyvs   c_yyvs
-#define yyvsp  c_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 c_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
index d8d78fd7111a39bd94786553754fe5ed413ae4ce..8192e97942f4e24647d8e486944aadf2b65f1aa2 100644 (file)
@@ -835,7 +835,7 @@ const struct language_defn c_language_defn =
   macro_expansion_c,
   &exp_descriptor_c,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
@@ -962,7 +962,7 @@ const struct language_defn cplus_language_defn =
   macro_expansion_c,
   &exp_descriptor_c,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
@@ -1007,7 +1007,7 @@ const struct language_defn asm_language_defn =
   macro_expansion_c,
   &exp_descriptor_c,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
@@ -1057,7 +1057,7 @@ const struct language_defn minimal_language_defn =
   macro_expansion_c,
   &exp_descriptor_c,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
index 94861f52d5e688cad404e467f95eda9bb83bc443..bf50afc151afc361b298163aae29e5240d1ec13a 100644 (file)
@@ -63,7 +63,7 @@ DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type);
 
 extern int c_parse (struct parser_state *);
 
-extern void c_error (char *);
+extern void c_yyerror (char *);
 
 extern int c_parse_escape (const char **, struct obstack *);
 
index 54c01c5b4bc4d4cf8b708976b0845bfacdcfb8a2..e7b11e75d8f2f0d49c02e090ec6c9aeab9f526db 100644 (file)
 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
 #define parse_d_type(ps) builtin_d_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 d_maxdepth
-#define        yyparse d_parse_internal
-#define        yylex   d_lex
-#define        yyerror d_error
-#define        yylval  d_lval
-#define        yychar  d_char
-#define        yydebug d_debug
-#define        yypact  d_pact
-#define        yyr1    d_r1
-#define        yyr2    d_r2
-#define        yydef   d_def
-#define        yychk   d_chk
-#define        yypgo   d_pgo
-#define        yyact   d_act
-#define        yyexca  d_exca
-#define        yyerrflag d_errflag
-#define        yynerrs d_nerrs
-#define        yyps    d_ps
-#define        yypv    d_pv
-#define        yys     d_s
-#define        yy_yys  d_yys
-#define        yystate d_state
-#define        yytmp   d_tmp
-#define        yyv     d_v
-#define        yy_yyv  d_yyv
-#define        yyval   d_val
-#define        yylloc  d_lloc
-#define        yyreds  d_reds  /* With YYDEBUG defined */
-#define        yytoks  d_toks  /* With YYDEBUG defined */
-#define        yyname  d_name  /* With YYDEBUG defined */
-#define        yyrule  d_rule  /* With YYDEBUG defined */
-#define        yylhs   d_yylhs
-#define        yylen   d_yylen
-#define        yydefre d_yydefred
-#define        yydgoto d_yydgoto
-#define        yysindex d_yysindex
-#define        yyrindex d_yyrindex
-#define        yygindex d_yygindex
-#define        yytable d_yytable
-#define        yycheck d_yycheck
-#define        yyss    d_yyss
-#define        yysslim d_yysslim
-#define        yyssp   d_yyssp
-#define        yystacksize d_yystacksize
-#define        yyvs    d_yyvs
-#define        yyvsp   d_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 d_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
index e8a08e19c495d09a13d7a5b7da1448cbec94e430..0075fea9f602ba585eb7a894fc234b495ab262dc 100644 (file)
@@ -201,7 +201,7 @@ static const struct language_defn d_language_defn =
   macro_expansion_no,
   &exp_descriptor_c,
   d_parse,
-  d_error,
+  d_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant.  */
   c_printstr,                  /* Function to print string constant.  */
index 8f63f519df8e3cc18248dcacc1ccddd2bae9aee0..74be7a5f61f09162192b15ff88292be014b9d378 100644 (file)
@@ -58,7 +58,7 @@ struct builtin_d_type
 
 extern int d_parse (struct parser_state *);
 
-extern void d_error (char *);
+extern void d_yyerror (char *);
 
 /* Defined in d-lang.c  */
 
index 4faac3233e6e70934e25127366c3dfd67c702876..cd659a1e2233ff65b2279ceb63750462624ef6fc 100644 (file)
 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
 #define parse_f_type(ps) builtin_f_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 f_maxdepth
-#define        yyparse f_parse_internal
-#define        yylex   f_lex
-#define        yyerror f_error
-#define        yylval  f_lval
-#define        yychar  f_char
-#define        yydebug f_debug
-#define        yypact  f_pact  
-#define        yyr1    f_r1                    
-#define        yyr2    f_r2                    
-#define        yydef   f_def           
-#define        yychk   f_chk           
-#define        yypgo   f_pgo           
-#define        yyact   f_act           
-#define        yyexca  f_exca
-#define yyerrflag f_errflag
-#define yynerrs        f_nerrs
-#define        yyps    f_ps
-#define        yypv    f_pv
-#define        yys     f_s
-#define        yy_yys  f_yys
-#define        yystate f_state
-#define        yytmp   f_tmp
-#define        yyv     f_v
-#define        yy_yyv  f_yyv
-#define        yyval   f_val
-#define        yylloc  f_lloc
-#define yyreds f_reds          /* With YYDEBUG defined */
-#define yytoks f_toks          /* With YYDEBUG defined */
-#define yyname f_name          /* With YYDEBUG defined */
-#define yyrule f_rule          /* With YYDEBUG defined */
-#define yylhs  f_yylhs
-#define yylen  f_yylen
-#define yydefred f_yydefred
-#define yydgoto        f_yydgoto
-#define yysindex f_yysindex
-#define yyrindex f_yyrindex
-#define yygindex f_yygindex
-#define yytable         f_yytable
-#define yycheck         f_yycheck
-#define yyss   f_yyss
-#define yysslim        f_yysslim
-#define yyssp  f_yyssp
-#define yystacksize f_yystacksize
-#define yyvs   f_yyvs
-#define yyvsp  f_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 f_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
index 9854eb9bda273f58840c518b20122cbdfa09e972..22c308f92128ed0593d1d119abf021fb0b08b139 100644 (file)
@@ -246,7 +246,7 @@ const struct language_defn f_language_defn =
   macro_expansion_no,
   &exp_descriptor_standard,
   f_parse,                     /* parser */
-  f_error,                     /* parser error function */
+  f_yyerror,                   /* parser error function */
   null_post_parser,
   f_printchar,                 /* Print character constant */
   f_printstr,                  /* function to print string constant */
index eeca1070ab49a360c70e3d8d04c8d2ca92229935..45df770857a0f010180c018823cc8a650d508a0e 100644 (file)
@@ -25,7 +25,7 @@ struct parser_state;
 
 extern int f_parse (struct parser_state *);
 
-extern void f_error (char *);  /* Defined in f-exp.y */
+extern void f_yyerror (char *);        /* Defined in f-exp.y */
 
 extern void f_print_type (struct type *, const char *, struct ui_file *, int,
                          int, const struct type_print_options *);
index c4ea0f0ace98e22d78f6db1b9ade93e537b88ffd..1b0fe5b5f5f8e7af16d22a01b16538c4e3bf5c8a 100644 (file)
 
 #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.  */
index 96be458f3520c44abc8151b2596c4d6d2af7b509..84a366ac5ac5a9310a6e95c9ccf9f00dc9d547c4 100644 (file)
@@ -567,7 +567,7 @@ static const struct language_defn go_language_defn =
   macro_expansion_no,
   &exp_descriptor_c,
   go_parse,
-  go_error,
+  go_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant.  */
   c_printstr,                  /* Function to print string constant.  */
index 49a35805e81c03a1e5890aa025feb10221557f8a..5eb298e543e694d103389a30fd63979b3876d23b 100644 (file)
@@ -60,7 +60,7 @@ enum go_type
 
 extern int go_parse (struct parser_state *);
 
-extern void go_error (char *);
+extern void go_yyerror (char *);
 
 /* Defined in go-lang.c.  */
 
index 951ef4929e8204ef4204af3fc1433aefaf73e65b..79b8127b595f48024ed3c15818a893691818d041 100644 (file)
 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
 #define parse_java_type(ps) builtin_java_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 java_maxdepth
-#define        yyparse java_parse_internal
-#define        yylex   java_lex
-#define        yyerror java_error
-#define        yylval  java_lval
-#define        yychar  java_char
-#define        yydebug java_debug
-#define        yypact  java_pact       
-#define        yyr1    java_r1                 
-#define        yyr2    java_r2                 
-#define        yydef   java_def                
-#define        yychk   java_chk                
-#define        yypgo   java_pgo                
-#define        yyact   java_act                
-#define        yyexca  java_exca
-#define yyerrflag java_errflag
-#define yynerrs        java_nerrs
-#define        yyps    java_ps
-#define        yypv    java_pv
-#define        yys     java_s
-#define        yy_yys  java_yys
-#define        yystate java_state
-#define        yytmp   java_tmp
-#define        yyv     java_v
-#define        yy_yyv  java_yyv
-#define        yyval   java_val
-#define        yylloc  java_lloc
-#define yyreds java_reds               /* With YYDEBUG defined */
-#define yytoks java_toks               /* With YYDEBUG defined */
-#define yyname java_name               /* With YYDEBUG defined */
-#define yyrule java_rule               /* With YYDEBUG defined */
-#define yylhs  java_yylhs
-#define yylen  java_yylen
-#define yydefred java_yydefred
-#define yydgoto        java_yydgoto
-#define yysindex java_yysindex
-#define yyrindex java_yyrindex
-#define yygindex java_yygindex
-#define yytable         java_yytable
-#define yycheck         java_yycheck
-#define yyss   java_yyss
-#define yysslim        java_yysslim
-#define yyssp  java_yyssp
-#define yystacksize java_yystacksize
-#define yyvs   java_yyvs
-#define yyvsp  java_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 java_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
index 2355c1f863306ef2668dfd8cc17fc72616ed1db8..14aa0e0295c90f22b1d0090edcac9873fe3bfbc2 100644 (file)
@@ -1173,7 +1173,7 @@ const struct language_defn java_language_defn =
   macro_expansion_no,
   &exp_descriptor_java,
   java_parse,
-  java_error,
+  java_yyerror,
   null_post_parser,
   java_printchar,              /* Print a character constant */
   java_printstr,               /* Function to print string constant */
index 63b257bd221cdbee40cf33e8239241b0edaf3845..7183bd660cbccd1b9a47db10f22745f66ab36ba7 100644 (file)
@@ -26,7 +26,7 @@ struct parser_state;
 
 extern int java_parse (struct parser_state *); /* Defined in jv-exp.y */
 
-extern void java_error (char *);       /* Defined in jv-exp.y */
+extern void java_yyerror (char *);     /* Defined in jv-exp.y */
 
 struct builtin_java_type
 {
index a52744001f32615ee048903bf4dc3070ed7fa408..a8b431e366d8cfe66bbec0a8c54a1e775331e0d9 100644 (file)
 #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.  */
index bbf3ac7b2be0133fea5943afb0ad51a0b94f49ca..917da15d8084da571febdc0c52c31e4e81e89071 100644 (file)
@@ -365,7 +365,7 @@ const struct language_defn m2_language_defn =
   macro_expansion_no,
   &exp_descriptor_modula2,
   m2_parse,                    /* parser */
-  m2_error,                    /* parser error function */
+  m2_yyerror,                  /* parser error function */
   null_post_parser,
   m2_printchar,                        /* Print character constant */
   m2_printstr,                 /* function to print string constant */
index 7a03ee8a54846ff0b34543f43509809aa3dfdb5f..b749b21555928d766bcb5cc5831f1b5a1c9e3679 100644 (file)
@@ -22,7 +22,7 @@ struct parser_state;
 
 extern int m2_parse (struct parser_state *); /* Defined in m2-exp.y */
 
-extern void m2_error (char *); /* Defined in m2-exp.y */
+extern void m2_yyerror (char *);       /* Defined in m2-exp.y */
 
 /* Defined in m2-typeprint.c */
 extern void m2_print_type (struct type *, const char *, struct ui_file *, int,
index f58b1c4e3de9e128c99218d267759e1a99c1a79b..34f90e872eac1fb16a9c189f8cf5661fc7752268 100644 (file)
@@ -360,7 +360,7 @@ const struct language_defn objc_language_defn = {
   macro_expansion_c,
   &exp_descriptor_standard,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                /* Print a character constant */
   c_printstr,                 /* Function to print string constant */
index dfb68c0fa8749eea90b2f94940f7597b2346d7c5..779973579049e3cfb73fc4c6e60ec1798dfb3414 100644 (file)
@@ -1054,7 +1054,7 @@ const struct language_defn opencl_language_defn =
   macro_expansion_c,
   &exp_descriptor_opencl,
   c_parse,
-  c_error,
+  c_yyerror,
   null_post_parser,
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
index 8cbe5de067aeca07ba6fa95121b7e662cc361d47..fa6b22c03b37993e9544701f19fbaf44dbc9ba17 100644 (file)
 
 #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 pascal_maxdepth
-#define        yyparse pascal_parse_internal
-#define        yylex   pascal_lex
-#define        yyerror pascal_error
-#define        yylval  pascal_lval
-#define        yychar  pascal_char
-#define        yydebug pascal_debug
-#define        yypact  pascal_pact
-#define        yyr1    pascal_r1
-#define        yyr2    pascal_r2
-#define        yydef   pascal_def
-#define        yychk   pascal_chk
-#define        yypgo   pascal_pgo
-#define        yyact   pascal_act
-#define        yyexca  pascal_exca
-#define yyerrflag pascal_errflag
-#define yynerrs        pascal_nerrs
-#define        yyps    pascal_ps
-#define        yypv    pascal_pv
-#define        yys     pascal_s
-#define        yy_yys  pascal_yys
-#define        yystate pascal_state
-#define        yytmp   pascal_tmp
-#define        yyv     pascal_v
-#define        yy_yyv  pascal_yyv
-#define        yyval   pascal_val
-#define        yylloc  pascal_lloc
-#define yyreds pascal_reds             /* With YYDEBUG defined */
-#define yytoks pascal_toks             /* With YYDEBUG defined */
-#define yyname pascal_name             /* With YYDEBUG defined */
-#define yyrule pascal_rule             /* With YYDEBUG defined */
-#define yylhs  pascal_yylhs
-#define yylen  pascal_yylen
-#define yydefred pascal_yydefred
-#define yydgoto        pascal_yydgoto
-#define yysindex pascal_yysindex
-#define yyrindex pascal_yyrindex
-#define yygindex pascal_yygindex
-#define yytable         pascal_yytable
-#define yycheck         pascal_yycheck
-#define yyss   pascal_yyss
-#define yysslim        pascal_yysslim
-#define yyssp  pascal_yyssp
-#define yystacksize pascal_yystacksize
-#define yyvs   pascal_yyvs
-#define yyvsp  pascal_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 pascal_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
index a7aeb369b54a77af001edfa3ea1bbd1f9fb21581..8ff2682bf26de85c86aab94893e1f938c77146fd 100644 (file)
@@ -423,7 +423,7 @@ const struct language_defn pascal_language_defn =
   macro_expansion_no,
   &exp_descriptor_standard,
   pascal_parse,
-  pascal_error,
+  pascal_yyerror,
   null_post_parser,
   pascal_printchar,            /* Print a character constant */
   pascal_printstr,             /* Function to print string constant */
index 5a65faadc8f382f276701f9149d3914dbbe26ab4..d862b4938097a3ea676ce035135b13e37709eba0 100644 (file)
@@ -27,7 +27,7 @@ extern const char *pascal_main_name (void);
 
 extern int pascal_parse (struct parser_state *); /* Defined in p-exp.y */
 
-extern void pascal_error (char *);     /* Defined in p-exp.y */
+extern void pascal_yyerror (char *);   /* Defined in p-exp.y */
 
 /* Defined in p-typeprint.c */
 extern void pascal_print_type (struct type *, const char *, struct ui_file *,
diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
new file mode 100644 (file)
index 0000000..71fa946
--- /dev/null
@@ -0,0 +1,92 @@
+/* Copyright (C) 1986-2016 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* 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.  */
+
+/* NOTE: This is clumsy since BISON and FLEX provide --prefix options.
+   We are maintaining it to accommodate systems without BISON.  */
+
+/* Define GDB_YY_REMAP_PREFIX to the desired remapping prefix before
+   including this file.  */
+#ifndef GDB_YY_REMAP_PREFIX
+# error "GDB_YY_REMAP_PREFIX not defined"
+#endif
+
+#define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
+#define GDB_YY_REMAP_1(PREFIX, YYSYM) GDB_YY_REMAP_2 (PREFIX, YYSYM)
+#define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
+
+#define yymaxdepth     GDB_YY_REMAP (yymaxdepth)
+#define yyparse                GDB_YY_REMAP (yyparse)
+#define yylex          GDB_YY_REMAP (yylex)
+#define yyerror                GDB_YY_REMAP (yyerror)
+#define yylval         GDB_YY_REMAP (yylval)
+#define yychar         GDB_YY_REMAP (yychar)
+#define yydebug                GDB_YY_REMAP (yydebug)
+#define yypact         GDB_YY_REMAP (yypact)
+#define yyr1           GDB_YY_REMAP (yyr1)
+#define yyr2           GDB_YY_REMAP (yyr2)
+#define yydef          GDB_YY_REMAP (yydef)
+#define yychk          GDB_YY_REMAP (yychk)
+#define yypgo          GDB_YY_REMAP (yypgo)
+#define yyact          GDB_YY_REMAP (yyact)
+#define yyexca         GDB_YY_REMAP (yyexca)
+#define yyerrflag      GDB_YY_REMAP (yyerrflag)
+#define yynerrs                GDB_YY_REMAP (yynerrs)
+#define yyps           GDB_YY_REMAP (yyps)
+#define yypv           GDB_YY_REMAP (yypv)
+#define yys            GDB_YY_REMAP (yys)
+#define yy_yys         GDB_YY_REMAP (yy_yys)
+#define yystate                GDB_YY_REMAP (yystate)
+#define yytmp          GDB_YY_REMAP (yytmp)
+#define yyv            GDB_YY_REMAP (yyv)
+#define yy_yyv         GDB_YY_REMAP (yy_yyv)
+#define yyval          GDB_YY_REMAP (yyval)
+#define yylloc         GDB_YY_REMAP (yylloc)
+#define yyreds         GDB_YY_REMAP (yyreds)  /* With YYDEBUG defined */
+#define yytoks         GDB_YY_REMAP (yytoks)  /* With YYDEBUG defined */
+#define yyname         GDB_YY_REMAP (yyname)  /* With YYDEBUG defined */
+#define yyrule         GDB_YY_REMAP (yyrule)  /* With YYDEBUG defined */
+#define yylhs          GDB_YY_REMAP (yylhs)
+#define yylen          GDB_YY_REMAP (yylen)
+#define yydefred       GDB_YY_REMAP (yydefred)
+#define yydgoto                GDB_YY_REMAP (yydgoto)
+#define yysindex       GDB_YY_REMAP (yysindex)
+#define yyrindex       GDB_YY_REMAP (yyrindex)
+#define yygindex       GDB_YY_REMAP (yygindex)
+#define yytable                GDB_YY_REMAP (yytable)
+#define yycheck                GDB_YY_REMAP (yycheck)
+#define yyss           GDB_YY_REMAP (yyss)
+#define yysslim                GDB_YY_REMAP (yysslim)
+#define yyssp          GDB_YY_REMAP (yyssp)
+#define yystacksize    GDB_YY_REMAP (yystacksize)
+#define yyvs           GDB_YY_REMAP (yyvs)
+#define yyvsp          GDB_YY_REMAP (yyvsp)
+
+/* The following are common to all parsers.  */
+
+#ifndef YYDEBUG
+# define YYDEBUG 1  /* Default to yydebug support */
+#endif
+
+#define YYFPRINTF parser_fprintf
This page took 0.046173 seconds and 4 git commands to generate.