import gdb-1999-12-13 snapshot
[deliverable/binutils-gdb.git] / gdb / eval.c
index 3d8796228d2e76b2e5d7e4309792848238a8c37f..d054ac7ffbd3cfb996d91f01f4d64f5cc156072f 100644 (file)
@@ -59,7 +59,7 @@ static LONGEST
   init_array_element PARAMS ((value_ptr, value_ptr, struct expression *,
                              int *, enum noside, LONGEST, LONGEST));
 
-#ifdef __GNUC__
+#if defined (__GNUC__) && !__STDC__
 inline
 #endif
 static value_ptr
@@ -394,7 +394,6 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
   int code;
   int ix;
   long mem_offset;
-  struct symbol *sym;
   struct type **arg_types;
   int save_pos1;
 
@@ -842,10 +841,6 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
          int static_memfuncp;
          value_ptr temp = arg2;
          char tstr[256];
-         struct fn_field *fns_ptr;
-         int num_fns;
-         struct type *basetype;
-         int boffset;
 
          /* Method invocation : stuff "this" as first parameter */
          /* pai: this used to have lookup_pointer_type for some reason,
@@ -897,9 +892,12 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
          argvec[1] = arg2;
          argvec[0] = arg1;
        }
-      else
+      else if (op == OP_VAR_VALUE)
        {
          /* Non-member function being called */
+          /* fn: This can only be done for C++ functions.  A C-style function
+             in a C++ program, for instance, does not have the fields that 
+             are expected here */
 
          if (overload_resolution && (exp->language_defn->la_language == language_cplus))
            {
@@ -913,11 +911,11 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
 
              (void) find_overload_match (arg_types, nargs, NULL /* no need for name */ ,
                                 0 /* not method */ , 0 /* strict match */ ,
-                             NULL, exp->elts[5].symbol /* the function */ ,
+                     NULL, exp->elts[save_pos1+2].symbol /* the function */ ,
                                          NULL, &symp, NULL);
 
              /* Now fix the expression being evaluated */
-             exp->elts[5].symbol = symp;
+             exp->elts[save_pos1+2].symbol = symp;
              argvec[0] = evaluate_subexp_with_coercion (exp, &save_pos1, noside);
            }
          else
@@ -926,6 +924,11 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
              /* nothing to be done; argvec already correctly set up */
            }
        }
+      else
+       {
+         /* It is probably a C-style function */
+         /* nothing to be done; argvec already correctly set up */
+       }
 
     do_call_it:
 
@@ -1743,9 +1746,8 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
     default:
       /* Removing this case and compiling with gcc -Wall reveals that
          a lot of cases are hitting this case.  Some of these should
-         probably be removed from expression.h (e.g. do we need a BINOP_SCOPE
-         and an OP_SCOPE?); others are legitimate expressions which are
-         (apparently) not fully implemented.
+         probably be removed from expression.h; others are legitimate
+         expressions which are (apparently) not fully implemented.
 
          If there are any cases landing here which mean a user error,
          then they should be separate cases, with more descriptive
This page took 0.026224 seconds and 4 git commands to generate.