ubsan: fr30: left shift of negative value
[deliverable/binutils-gdb.git] / gdb / m2-exp.y
index 6ba8eaf8554c82ac85f04bac67d7170a83ccaea8..70a3d9c483a10b1baa2afc509968e3f9d15f8adf 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC grammar for Modula-2 expressions, for GDB.
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
    Generated from expread.y (now c-exp.y) and contributed by the Department
    of Computer Science at the State University of New York at Buffalo, 1991.
 
@@ -298,11 +298,11 @@ exp     :       exp '['
                         /* This function just saves the number of arguments
                           that follow in the list.  It is *not* specific to
                           function types */
-                        { start_arglist(); }
+                        { pstate->start_arglist(); }
                 non_empty_arglist ']'  %prec DOT
                         { write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT);
                          write_exp_elt_longcst (pstate,
-                                                (LONGEST) end_arglist());
+                                                pstate->end_arglist());
                          write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); }
         ;
 
@@ -313,11 +313,11 @@ exp       :       exp '[' exp ']'
 exp    :       exp '('
                        /* This is to save the value of arglist_len
                           being accumulated by an outer function call.  */
-                       { start_arglist (); }
+                       { pstate->start_arglist (); }
                arglist ')'     %prec DOT
                        { write_exp_elt_opcode (pstate, OP_FUNCALL);
                          write_exp_elt_longcst (pstate,
-                                                (LONGEST) end_arglist ());
+                                                pstate->end_arglist ());
                          write_exp_elt_opcode (pstate, OP_FUNCALL); }
        ;
 
@@ -325,21 +325,21 @@ arglist   :
        ;
 
 arglist        :       exp
-                       { arglist_len = 1; }
+                       { pstate->arglist_len = 1; }
        ;
 
 arglist        :       arglist ',' exp   %prec ABOVE_COMMA
-                       { arglist_len++; }
+                       { pstate->arglist_len++; }
        ;
 
 non_empty_arglist
         :       exp
-                        { arglist_len = 1; }
+                        { pstate->arglist_len = 1; }
        ;
 
 non_empty_arglist
         :       non_empty_arglist ',' exp %prec ABOVE_COMMA
-                       { arglist_len++; }
+                       { pstate->arglist_len++; }
        ;
 
 /* GDB construct */
@@ -507,7 +507,7 @@ block       :       fblock
 
 fblock :       BLOCKNAME
                        { struct symbol *sym
-                           = lookup_symbol (copy_name ($1),
+                           = lookup_symbol (copy_name ($1).c_str (),
                                             pstate->expression_context_block,
                                             VAR_DOMAIN, 0).symbol;
                          $$ = sym;}
@@ -517,11 +517,11 @@ fblock    :       BLOCKNAME
 /* GDB scope operator */
 fblock :       block COLONCOLON BLOCKNAME
                        { struct symbol *tem
-                           = lookup_symbol (copy_name ($3), $1,
+                           = lookup_symbol (copy_name ($3).c_str (), $1,
                                             VAR_DOMAIN, 0).symbol;
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
                            error (_("No function \"%s\" in specified context."),
-                                  copy_name ($3));
+                                  copy_name ($3).c_str ());
                          $$ = tem;
                        }
        ;
@@ -541,14 +541,14 @@ variable: DOLLAR_VARIABLE
 /* GDB scope operator */
 variable:      block COLONCOLON NAME
                        { struct block_symbol sym
-                           = lookup_symbol (copy_name ($3), $1,
+                           = lookup_symbol (copy_name ($3).c_str (), $1,
                                             VAR_DOMAIN, 0);
 
                          if (sym.symbol == 0)
                            error (_("No symbol \"%s\" in specified context."),
-                                  copy_name ($3));
+                                  copy_name ($3).c_str ());
                          if (symbol_read_needs_frame (sym.symbol))
-                           innermost_block.update (sym);
+                           pstate->block_tracker->update (sym);
 
                          write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                          write_exp_elt_block (pstate, sym.block);
@@ -562,7 +562,7 @@ variable:   NAME
                          struct field_of_this_result is_a_field_of_this;
 
                          sym
-                           = lookup_symbol (copy_name ($1),
+                           = lookup_symbol (copy_name ($1).c_str (),
                                             pstate->expression_context_block,
                                             VAR_DOMAIN,
                                             &is_a_field_of_this);
@@ -570,7 +570,7 @@ variable:   NAME
                          if (sym.symbol)
                            {
                              if (symbol_read_needs_frame (sym.symbol))
-                               innermost_block.update (sym);
+                               pstate->block_tracker->update (sym);
 
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                              write_exp_elt_block (pstate, sym.block);
@@ -580,17 +580,17 @@ variable: NAME
                          else
                            {
                              struct bound_minimal_symbol msymbol;
-                             char *arg = copy_name ($1);
+                             std::string arg = copy_name ($1);
 
                              msymbol =
-                               lookup_bound_minimal_symbol (arg);
+                               lookup_bound_minimal_symbol (arg.c_str ());
                              if (msymbol.minsym != NULL)
                                write_exp_msymbol (pstate, msymbol);
                              else if (!have_full_symbols () && !have_partial_symbols ())
                                error (_("No symbol table is loaded.  Use the \"symbol-file\" command."));
                              else
                                error (_("No symbol \"%s\" in current context."),
-                                      copy_name ($1));
+                                      arg.c_str ());
                            }
                        }
        ;
@@ -599,8 +599,7 @@ type
        :       TYPENAME
                        { $$
                            = lookup_typename (pstate->language (),
-                                              pstate->gdbarch (),
-                                              copy_name ($1),
+                                              copy_name ($1).c_str (),
                                               pstate->expression_context_block,
                                               0);
                        }
@@ -965,20 +964,17 @@ yylex (void)
      currently as names of types; NAME for other symbols.
      The caller is not constrained to care about the distinction.  */
  {
-
-
-    char *tmp = copy_name (yylval.sval);
+    std::string tmp = copy_name (yylval.sval);
     struct symbol *sym;
 
-    if (lookup_symtab (tmp))
+    if (lookup_symtab (tmp.c_str ()))
       return BLOCKNAME;
-    sym = lookup_symbol (tmp, pstate->expression_context_block,
+    sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
                         VAR_DOMAIN, 0).symbol;
     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
       return BLOCKNAME;
-    if (lookup_typename (pstate->language (), pstate->gdbarch (),
-                        copy_name (yylval.sval),
-                        pstate->expression_context_block, 1))
+    if (lookup_typename (pstate->language (),
+                        tmp.c_str (), pstate->expression_context_block, 1))
       return TYPENAME;
 
     if(sym)
This page took 0.027648 seconds and 4 git commands to generate.