gdb: include gdbsupport/buildargv.h in ser-mingw.c
[binutils-gdb.git] / gdb / go-exp.y
index d096cc8b7c91c2de42624389ea31e058e20ffcdd..359af2260568420162dfd73e53cde304c8d4c703 100644 (file)
@@ -1,6 +1,6 @@
 /* YACC parser for Go expressions, for GDB.
 
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
+   Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -563,8 +563,7 @@ variable:   name_not_typename
                              if (symbol_read_needs_frame (sym.symbol))
                                pstate->block_tracker->update (sym);
 
-                             pstate->push_new<var_value_operation>
-                               (sym.symbol, sym.block);
+                             pstate->push_new<var_value_operation> (sym);
                            }
                          else if ($1.is_a_field_of_this)
                            {
@@ -581,7 +580,7 @@ variable:   name_not_typename
                                lookup_bound_minimal_symbol (arg.c_str ());
                              if (msymbol.minsym != NULL)
                                pstate->push_new<var_msym_value_operation>
-                                 (msymbol.minsym, msymbol.objfile);
+                                 (msymbol);
                              else if (!have_full_symbols ()
                                       && !have_partial_symbols ())
                                error (_("No symbol table is loaded.  "
@@ -1019,7 +1018,6 @@ lex_one_token (struct parser_state *par_state)
 {
   int c;
   int namelen;
-  unsigned int i;
   const char *tokstart;
   int saw_structop = last_was_structop;
 
@@ -1031,23 +1029,23 @@ lex_one_token (struct parser_state *par_state)
 
   tokstart = par_state->lexptr;
   /* See if it is a special token of length 3.  */
-  for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
-    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
+  for (const auto &token : tokentab3)
+    if (strncmp (tokstart, token.oper, 3) == 0)
       {
        par_state->lexptr += 3;
-       yylval.opcode = tokentab3[i].opcode;
-       return tokentab3[i].token;
+       yylval.opcode = token.opcode;
+       return token.token;
       }
 
   /* See if it is a special token of length 2.  */
-  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
+  for (const auto &token : tokentab2)
+    if (strncmp (tokstart, token.oper, 2) == 0)
       {
        par_state->lexptr += 2;
-       yylval.opcode = tokentab2[i].opcode;
+       yylval.opcode = token.opcode;
        /* NOTE: -> doesn't exist in Go, so we don't need to watch for
           setting last_was_structop here.  */
-       return tokentab2[i].token;
+       return token.token;
       }
 
   switch (c = *tokstart)
@@ -1271,13 +1269,13 @@ lex_one_token (struct parser_state *par_state)
 
   /* Catch specific keywords.  */
   std::string copy = copy_name (yylval.sval);
-  for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
-    if (copy == ident_tokens[i].oper)
+  for (const auto &token : ident_tokens)
+    if (copy == token.oper)
       {
        /* It is ok to always set this, even though we don't always
           strictly need to.  */
-       yylval.opcode = ident_tokens[i].opcode;
-       return ident_tokens[i].token;
+       yylval.opcode = token.opcode;
+       return token.token;
       }
 
   if (*tokstart == '$')