-Wwrite-strings: The Rest
[deliverable/binutils-gdb.git] / gdb / p-exp.y
index 191b3d37f276e989e7c4e24a72ff3e2324511aa4..81eb2162589678c2205fbec94881610a38eeb756 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC parser for Pascal expressions, for GDB.
-   Copyright (C) 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 2000-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
 #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.  */
@@ -127,7 +72,7 @@ int yyparse (void);
 
 static int yylex (void);
 
-void yyerror (char *);
+void yyerror (const char *);
 
 static char *uptok (const char *, int);
 %}
@@ -364,7 +309,7 @@ exp :       exp '['
                              struct stoken stringsval;
                              char *buf;
 
-                             buf = alloca (strlen (arrayname) + 1);
+                             buf = (char *) alloca (strlen (arrayname) + 1);
                              stringsval.ptr = buf;
                              stringsval.length = strlen (arrayname);
                              strcpy (buf, arrayname);
@@ -772,10 +717,7 @@ variable:  name_not_typename
                                }
 
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
-                             /* We want to use the selected frame, not
-                                another more inner frame which happens to
-                                be in the same block.  */
-                             write_exp_elt_block (pstate, NULL);
+                             write_exp_elt_block (pstate, sym.block);
                              write_exp_elt_sym (pstate, sym.symbol);
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                              current_type = sym.symbol->type; }
@@ -1105,7 +1047,7 @@ pop_current_type (void)
 
 struct token
 {
-  char *oper;
+  const char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1533,7 +1475,7 @@ yylex (void)
         so in expression to enter hexadecimal values
         we still need to use C syntax with 0xff  */
       write_dollar_variable (pstate, yylval.sval);
-      tmp = alloca (namelen + 1);
+      tmp = (char *) alloca (namelen + 1);
       memcpy (tmp, tokstart, namelen);
       tmp[namelen] = '\0';
       intvar = lookup_only_internalvar (tmp + 1);
@@ -1679,7 +1621,9 @@ yylex (void)
                      struct symbol *cur_sym;
                      /* As big as the whole rest of the expression, which is
                         at least big enough.  */
-                     char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
+                     char *ncopy
+                       = (char *) alloca (strlen (tmp) + strlen (namestart)
+                                          + 3);
                      char *tmp1;
 
                      tmp1 = ncopy;
@@ -1770,7 +1714,7 @@ pascal_parse (struct parser_state *par_state)
 }
 
 void
-yyerror (char *msg)
+yyerror (const char *msg)
 {
   if (prev_lexptr)
     lexptr = prev_lexptr;
This page took 0.027028 seconds and 4 git commands to generate.