[GOLD] Modify script_test_12
[external/binutils.git] / gdb / parse.c
index 6b59c4f..2b00708 100644 (file)
@@ -1,6 +1,6 @@
 /* Parse expressions for GDB.
 
 /* Parse expressions for GDB.
 
-   Copyright (C) 1986-2015 Free Software Foundation, Inc.
+   Copyright (C) 1986-2016 Free Software Foundation, Inc.
 
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
 
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
@@ -142,7 +142,7 @@ start_arglist (void)
 {
   struct funcall *newobj;
 
 {
   struct funcall *newobj;
 
-  newobj = (struct funcall *) xmalloc (sizeof (struct funcall));
+  newobj = XNEW (struct funcall);
   newobj->next = funcall_chain;
   newobj->arglist_len = arglist_len;
   arglist_len = 0;
   newobj->next = funcall_chain;
   newobj->arglist_len = arglist_len;
   arglist_len = 0;
@@ -189,8 +189,9 @@ initialize_expout (struct parser_state *ps, size_t initial_size,
 {
   ps->expout_size = initial_size;
   ps->expout_ptr = 0;
 {
   ps->expout_size = initial_size;
   ps->expout_ptr = 0;
-  ps->expout = xmalloc (sizeof (struct expression)
-                       + EXP_ELEM_TO_BYTES (ps->expout_size));
+  ps->expout
+    = (struct expression *) xmalloc (sizeof (struct expression)
+                                    + EXP_ELEM_TO_BYTES (ps->expout_size));
   ps->expout->language_defn = lang;
   ps->expout->gdbarch = gdbarch;
 }
   ps->expout->language_defn = lang;
   ps->expout->gdbarch = gdbarch;
 }
@@ -585,7 +586,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
              || tag == TYPE_CODE_STRUCT
              || tag == TYPE_CODE_ENUM);
   expout_tag_completion_type = tag;
              || tag == TYPE_CODE_STRUCT
              || tag == TYPE_CODE_ENUM);
   expout_tag_completion_type = tag;
-  expout_completion_name = xmalloc (length + 1);
+  expout_completion_name = (char *) xmalloc (length + 1);
   memcpy (expout_completion_name, ptr, length);
   expout_completion_name[length] = '\0';
 }
   memcpy (expout_completion_name, ptr, length);
   expout_completion_name[length] = '\0';
 }
@@ -615,7 +616,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
 void
 write_dollar_variable (struct parser_state *ps, struct stoken str)
 {
 void
 write_dollar_variable (struct parser_state *ps, struct stoken str)
 {
-  struct symbol *sym = NULL;
+  struct block_symbol sym;
   struct bound_minimal_symbol msym;
   struct internalvar *isym = NULL;
 
   struct bound_minimal_symbol msym;
   struct internalvar *isym = NULL;
 
@@ -672,11 +673,11 @@ write_dollar_variable (struct parser_state *ps, struct stoken str)
 
   sym = lookup_symbol (copy_name (str), (struct block *) NULL,
                       VAR_DOMAIN, NULL);
 
   sym = lookup_symbol (copy_name (str), (struct block *) NULL,
                       VAR_DOMAIN, NULL);
-  if (sym)
+  if (sym.symbol)
     {
       write_exp_elt_opcode (ps, OP_VAR_VALUE);
     {
       write_exp_elt_opcode (ps, OP_VAR_VALUE);
-      write_exp_elt_block (ps, block_found);   /* set by lookup_symbol */
-      write_exp_elt_sym (ps, sym);
+      write_exp_elt_block (ps, sym.block);
+      write_exp_elt_sym (ps, sym.symbol);
       write_exp_elt_opcode (ps, OP_VAR_VALUE);
       return;
     }
       write_exp_elt_opcode (ps, OP_VAR_VALUE);
       return;
     }
@@ -795,7 +796,7 @@ copy_name (struct stoken token)
   if (namecopy_size < token.length + 1)
     {
       namecopy_size = token.length + 1;
   if (namecopy_size < token.length + 1)
     {
       namecopy_size = token.length + 1;
-      namecopy = xrealloc (namecopy, token.length + 1);
+      namecopy = (char *) xrealloc (namecopy, token.length + 1);
     }
       
   memcpy (namecopy, token.ptr, token.length);
     }
       
   memcpy (namecopy, token.ptr, token.length);
@@ -861,7 +862,7 @@ operator_length_standard (const struct expression *expr, int endpos,
 {
   int oplen = 1;
   int args = 0;
 {
   int oplen = 1;
   int args = 0;
-  enum f90_range_type range_type;
+  enum range_type range_type;
   int i;
 
   if (endpos < 1)
   int i;
 
   if (endpos < 1)
@@ -1003,10 +1004,11 @@ operator_length_standard (const struct expression *expr, int endpos,
       oplen = 2;
       break;
 
       oplen = 2;
       break;
 
-    case OP_F90_RANGE:
+    case OP_RANGE:
       oplen = 3;
       oplen = 3;
+      range_type = (enum range_type)
+       longest_to_int (expr->elts[endpos - 2].longconst);
 
 
-      range_type = longest_to_int (expr->elts[endpos - 2].longconst);
       switch (range_type)
        {
        case LOW_BOUND_DEFAULT:
       switch (range_type)
        {
        case LOW_BOUND_DEFAULT:
@@ -1372,7 +1374,7 @@ parse_float (const char *p, int len, DOUBLEST *d, const char **suffix)
   char *copy;
   int n, num;
 
   char *copy;
   int n, num;
 
-  copy = xmalloc (len + 1);
+  copy = (char *) xmalloc (len + 1);
   memcpy (copy, p, len);
   copy[len] = 0;
 
   memcpy (copy, p, len);
   copy[len] = 0;
 
@@ -1438,8 +1440,8 @@ type_stack_reserve (struct type_stack *stack, int howmuch)
       stack->size *= 2;
       if (stack->size < howmuch)
        stack->size = howmuch;
       stack->size *= 2;
       if (stack->size < howmuch)
        stack->size = howmuch;
-      stack->elements = xrealloc (stack->elements,
-                                 stack->size * sizeof (union type_stack_elt));
+      stack->elements = XRESIZEVEC (union type_stack_elt, stack->elements,
+                                   stack->size);
     }
 }
 
     }
 }
 
@@ -1619,7 +1621,7 @@ get_type_stack (void)
 void
 type_stack_cleanup (void *arg)
 {
 void
 type_stack_cleanup (void *arg)
 {
-  struct type_stack *stack = arg;
+  struct type_stack *stack = (struct type_stack *) arg;
 
   xfree (stack->elements);
   xfree (stack);
 
   xfree (stack->elements);
   xfree (stack);
@@ -1896,7 +1898,7 @@ exp_iterate (struct expression *exp,
 static int
 exp_uses_objfile_iter (struct objfile *exp_objfile, void *objfile_voidp)
 {
 static int
 exp_uses_objfile_iter (struct objfile *exp_objfile, void *objfile_voidp)
 {
-  struct objfile *objfile = objfile_voidp;
+  struct objfile *objfile = (struct objfile *) objfile_voidp;
 
   if (exp_objfile->separate_debug_objfile_backlink)
     exp_objfile = exp_objfile->separate_debug_objfile_backlink;
 
   if (exp_objfile->separate_debug_objfile_backlink)
     exp_objfile = exp_objfile->separate_debug_objfile_backlink;