changes, what else?
[deliverable/binutils-gdb.git] / gdb / parse.c
index 214df03b6b5d8307e865b09001b06990e3a85e07..5cfad975033c3f58560c3354e149ac5eb06b6820 100644 (file)
@@ -28,10 +28,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
    during the process of parsing; the lower levels of the tree always
    come first in the result.  */
    
-#include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "symtab.h"
+#include "gdbtypes.h"
 #include "frame.h"
 #include "expression.h"
 #include "value.h"
@@ -39,6 +38,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "language.h"
 #include "parser-defs.h"
 
+static void
+prefixify_expression PARAMS ((struct expression *));
+
+static int
+length_of_subexp PARAMS ((struct expression *, int));
+
+static void
+prefixify_subexp PARAMS ((struct expression *, struct expression *, int, int));
+
 /* Assign machine-independent names to certain registers 
    (unless overridden by the REGISTER_NAMES table) */
 
@@ -84,7 +92,7 @@ end_arglist ()
   register struct funcall *call = funcall_chain;
   funcall_chain = call->next;
   arglist_len = call->arglist_len;
-  free (call);
+  free ((PTR)call);
   return val;
 }
 
@@ -99,7 +107,7 @@ free_funcalls ()
   for (call = funcall_chain; call; call = next)
     {
       next = call->next;
-      free (call);
+      free ((PTR)call);
     }
 }
 \f
@@ -118,7 +126,7 @@ write_exp_elt (expelt)
   if (expout_ptr >= expout_size)
     {
       expout_size *= 2;
-      expout = (struct expression *) xrealloc (expout,
+      expout = (struct expression *) xrealloc ((char *) expout,
                                               sizeof (struct expression)
                                               + expout_size * sizeof (union exp_element));
     }
@@ -208,10 +216,10 @@ write_exp_string (str)
     {
       expout_size = max (expout_size * 2, expout_ptr + 10);
       expout = (struct expression *)
-       xrealloc (expout, (sizeof (struct expression)
+       xrealloc ((char *) expout, (sizeof (struct expression)
                           + (expout_size * sizeof (union exp_element))));
     }
-  bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len);
+  memcpy ((char *) &expout->elts[expout_ptr - lenelt], str.ptr, len);
   ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0;
   write_exp_elt_longcst ((LONGEST) len);
 }
@@ -223,7 +231,7 @@ char *
 copy_name (token)
      struct stoken token;
 {
-  bcopy (token.ptr, namecopy, token.length);
+  memcpy (namecopy, token.ptr, token.length);
   namecopy[token.length] = 0;
   return namecopy;
 }
@@ -231,9 +239,7 @@ copy_name (token)
 /* Reverse an expression from suffix form (in which it is constructed)
    to prefix form (in which we can conveniently print or execute it).  */
 
-static void prefixify_subexp ();
-
-void
+static void
 prefixify_expression (expr)
      register struct expression *expr;
 {
@@ -245,7 +251,7 @@ prefixify_expression (expr)
   temp = (struct expression *) alloca (len);
 
   /* Copy the original expression into temp.  */
-  bcopy (expr, temp, len);
+  memcpy (temp, expr, len);
 
   prefixify_subexp (temp, expr, inpos, outpos);
 }
@@ -253,7 +259,7 @@ prefixify_expression (expr)
 /* Return the number of exp_elements in the subexpression of EXPR
    whose last exp_element is at index ENDPOS - 1 in EXPR.  */
 
-int
+static int
 length_of_subexp (expr, endpos)
      register struct expression *expr;
      register int endpos;
@@ -269,6 +275,9 @@ length_of_subexp (expr, endpos)
 
   switch (i)
     {
+    case STRUCTOP_STRUCT:
+    case STRUCTOP_PTR:
+      args = 1;
       /* C++  */
     case OP_SCOPE:
       oplen = 4 + ((expr->elts[endpos - 2].longconst
@@ -320,9 +329,6 @@ length_of_subexp (expr, endpos)
       args = 1;
       break;
 
-    case STRUCTOP_STRUCT:
-    case STRUCTOP_PTR:
-      args = 1;
     case OP_M2_STRING:
     case OP_STRING:
       oplen = 3 + ((expr->elts[endpos - 2].longconst
@@ -387,6 +393,9 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
   opcode = inexpr->elts[inend - 1].opcode;
   switch (opcode)
     {
+    case STRUCTOP_STRUCT:
+    case STRUCTOP_PTR:
+      args = 1;
       /* C++  */
     case OP_SCOPE:
       oplen = 4 + ((inexpr->elts[inend - 2].longconst
@@ -437,9 +446,6 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
       args=1;
       break;
 
-   case STRUCTOP_STRUCT:
-    case STRUCTOP_PTR:
-      args = 1;
     case OP_M2_STRING:
     case OP_STRING:
       oplen = 3 + ((inexpr->elts[inend - 2].longconst
@@ -475,8 +481,8 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
   /* Copy the final operator itself, from the end of the input
      to the beginning of the output.  */
   inend -= oplen;
-  bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg],
-        oplen * sizeof (union exp_element));
+  memcpy (&outexpr->elts[outbeg], &inexpr->elts[inend],
+                oplen * sizeof (union exp_element));
   outbeg += oplen;
 
   /* Find the lengths of the arg subexpressions.  */
@@ -553,7 +559,7 @@ parse_exp_1 (stringptr, block, comma)
   discard_cleanups (old_chain);
   expout->nelts = expout_ptr;
   expout = (struct expression *)
-    xrealloc (expout,
+    xrealloc ((char *) expout,
              sizeof (struct expression)
              + expout_ptr * sizeof (union exp_element));
   prefixify_expression (expout);
@@ -583,7 +589,7 @@ push_type (tp)
     {
       type_stack_size *= 2;
       type_stack = (union type_stack_elt *)
-       xrealloc (type_stack, type_stack_size * sizeof (*type_stack));
+       xrealloc ((char *) type_stack, type_stack_size * sizeof (*type_stack));
     }
   type_stack[type_stack_depth++].piece = tp;
 }
@@ -596,7 +602,7 @@ push_type_int (n)
     {
       type_stack_size *= 2;
       type_stack = (union type_stack_elt *)
-       xrealloc (type_stack, type_stack_size * sizeof (*type_stack));
+       xrealloc ((char *) type_stack, type_stack_size * sizeof (*type_stack));
     }
   type_stack[type_stack_depth++].int_val = n;
 }
This page took 0.025783 seconds and 4 git commands to generate.