arm-tdep.c: Remove unused variables
[deliverable/binutils-gdb.git] / gdb / go-exp.y
index 51781783c4099f9ba616614e8a45d30683a33a47..c4ea0f0ace98e22d78f6db1b9ade93e537b88ffd 100644 (file)
@@ -1,6 +1,6 @@
 /* YACC parser for Go expressions, for GDB.
 
-   Copyright (C) 2012-2014 Free Software Foundation, Inc.
+   Copyright (C) 2012-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -508,7 +508,7 @@ exp :       SIZEOF_KEYWORD '(' type ')'  %prec UNARY
                          write_exp_elt_type
                            (pstate,
                             parse_type (pstate)->builtin_unsigned_int);
-                         CHECK_TYPEDEF ($3);
+                         $3 = check_typedef ($3);
                          write_exp_elt_longcst (pstate,
                                                 (LONGEST) TYPE_LENGTH ($3));
                          write_exp_elt_opcode (pstate, OP_LONG);
@@ -535,7 +535,7 @@ string_exp:
 
                          vec->type = $1.type;
                          vec->length = $1.length;
-                         vec->ptr = malloc ($1.length + 1);
+                         vec->ptr = (char *) malloc ($1.length + 1);
                          memcpy (vec->ptr, $1.ptr, $1.length + 1);
                        }
 
@@ -545,10 +545,10 @@ string_exp:
                             for convenience.  */
                          char *p;
                          ++$$.len;
-                         $$.tokens = realloc ($$.tokens,
-                                              $$.len * sizeof (struct typed_stoken));
+                         $$.tokens = XRESIZEVEC (struct typed_stoken,
+                                                 $$.tokens, $$.len);
 
-                         p = malloc ($3.length + 1);
+                         p = (char *) malloc ($3.length + 1);
                          memcpy (p, $3.ptr, $3.length + 1);
 
                          $$.tokens[$$.len - 1].type = $3.type;
@@ -582,7 +582,7 @@ exp :       FALSE_KEYWORD
        ;
 
 variable:      name_not_typename ENTRY
-                       { struct symbol *sym = $1.sym;
+                       { struct symbol *sym = $1.sym.symbol;
 
                          if (sym == NULL
                              || !SYMBOL_IS_ARGUMENT (sym)
@@ -598,24 +598,21 @@ variable: name_not_typename ENTRY
        ;
 
 variable:      name_not_typename
-                       { struct symbol *sym = $1.sym;
+                       { struct block_symbol sym = $1.sym;
 
-                         if (sym)
+                         if (sym.symbol)
                            {
-                             if (symbol_read_needs_frame (sym))
+                             if (symbol_read_needs_frame (sym.symbol))
                                {
                                  if (innermost_block == 0
-                                     || contained_in (block_found,
+                                     || contained_in (sym.block,
                                                       innermost_block))
-                                   innermost_block = block_found;
+                                   innermost_block = sym.block;
                                }
 
                              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_sym (pstate, sym);
+                             write_exp_elt_block (pstate, sym.block);
+                             write_exp_elt_sym (pstate, sym.symbol);
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                            }
                          else if ($1.is_a_field_of_this)
@@ -978,7 +975,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
   ++tokptr;
 
   value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/
-  value->ptr = obstack_base (&tempbuf);
+  value->ptr = (char *) obstack_base (&tempbuf);
   value->length = obstack_object_size (&tempbuf);
 
   *outptr = tokptr;
@@ -988,7 +985,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
 
 struct token
 {
-  char *operator;
+  char *oper;
   int token;
   enum exp_opcode opcode;
 };
@@ -1075,7 +1072,7 @@ lex_one_token (struct parser_state *par_state)
   tokstart = 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].operator, 3) == 0)
+    if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
       {
        lexptr += 3;
        yylval.opcode = tokentab3[i].opcode;
@@ -1084,7 +1081,7 @@ lex_one_token (struct parser_state *par_state)
 
   /* 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].operator, 2) == 0)
+    if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
       {
        lexptr += 2;
        yylval.opcode = tokentab2[i].opcode;
@@ -1315,7 +1312,7 @@ lex_one_token (struct parser_state *par_state)
   /* Catch specific keywords.  */
   copy = copy_name (yylval.sval);
   for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
-    if (strcmp (copy, ident_tokens[i].operator) == 0)
+    if (strcmp (copy, ident_tokens[i].oper) == 0)
       {
        /* It is ok to always set this, even though we don't always
           strictly need to.  */
@@ -1366,7 +1363,7 @@ build_packaged_name (const char *package, int package_len,
   obstack_grow_str (&name_obstack, ".");
   obstack_grow (&name_obstack, name, name_len);
   obstack_grow (&name_obstack, "", 1);
-  result.ptr = obstack_base (&name_obstack);
+  result.ptr = (char *) obstack_base (&name_obstack);
   result.length = obstack_object_size (&name_obstack) - 1;
 
   return result;
@@ -1382,7 +1379,7 @@ package_name_p (const char *name, const struct block *block)
   struct symbol *sym;
   struct field_of_this_result is_a_field_of_this;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this);
+  sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol;
 
   if (sym
       && SYMBOL_CLASS (sym) == LOC_TYPEDEF
@@ -1420,14 +1417,14 @@ static int
 classify_packaged_name (const struct block *block)
 {
   char *copy;
-  struct symbol *sym;
+  struct block_symbol sym;
   struct field_of_this_result is_a_field_of_this;
 
   copy = copy_name (yylval.sval);
 
   sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
 
-  if (sym)
+  if (sym.symbol)
     {
       yylval.ssym.sym = sym;
       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
@@ -1448,7 +1445,7 @@ static int
 classify_name (struct parser_state *par_state, const struct block *block)
 {
   struct type *type;
-  struct symbol *sym;
+  struct block_symbol sym;
   char *copy;
   struct field_of_this_result is_a_field_of_this;
 
@@ -1471,7 +1468,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
 
   sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
 
-  if (sym)
+  if (sym.symbol)
     {
       yylval.ssym.sym = sym;
       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
@@ -1496,7 +1493,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
        xfree (current_package_name);
        sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
                             &is_a_field_of_this);
-       if (sym)
+       if (sym.symbol)
          {
            yylval.ssym.stoken = sval;
            yylval.ssym.sym = sym;
@@ -1517,13 +1514,15 @@ classify_name (struct parser_state *par_state, const struct block *block)
                                  0, &newlval);
       if (hextype == INT)
        {
-         yylval.ssym.sym = NULL;
+         yylval.ssym.sym.symbol = NULL;
+         yylval.ssym.sym.block = NULL;
          yylval.ssym.is_a_field_of_this = 0;
          return NAME_OR_INT;
        }
     }
 
-  yylval.ssym.sym = NULL;
+  yylval.ssym.sym.symbol = NULL;
+  yylval.ssym.sym.block = NULL;
   yylval.ssym.is_a_field_of_this = 0;
   return NAME;
 }
This page took 0.026507 seconds and 4 git commands to generate.