This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit/cleanup] delete redundant ada-lang.c:evaluate_subexp


Hello,

I noticed a redundant routine in ada-lang.c, so I deleted it. and while
I was looking at it, I noticed another location in objc-lang.c where
it could be used... The latter change is not strictly necessary, but
it's more consistent with the rest of the code.

2009-05-22  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (evaluate_subexp): Delete.  Use the version from eval.c.
        (evaluate_subexp_type): Reimplement using evaluate_subexp.
        * value.h (evaluate_subexp): Add declaration.
        * eval.c (evaluate_subexp): Make non-static.
        * objc-lang.c (print_object_command): Use evaluate_subexp.

Tested on x86-linux. Will commit in a couple of days if no objection.

-- 
Joel
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c4b7139..3b33824 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -157,9 +157,6 @@ static struct symbol *find_old_style_renaming_symbol (const char *,
 static struct type *ada_lookup_struct_elt_type (struct type *, char *,
                                                 int, int, int *);
 
-static struct value *evaluate_subexp (struct type *, struct expression *,
-                                      int *, enum noside);
-
 static struct value *evaluate_subexp_type (struct expression *, int *);
 
 static struct type *ada_find_parallel_type_with_name (struct type *,
@@ -7792,14 +7789,6 @@ ada_enum_name (const char *name)
     }
 }
 
-static struct value *
-evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos,
-                 enum noside noside)
-{
-  return (*exp->language_defn->la_exp_desc->evaluate_exp)
-    (expect_type, exp, pos, noside);
-}
-
 /* Evaluate the subexpression of EXP starting at *POS as for
    evaluate_type, updating *POS to point just past the evaluated
    expression.  */
@@ -7807,8 +7796,7 @@ evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos,
 static struct value *
 evaluate_subexp_type (struct expression *exp, int *pos)
 {
-  return (*exp->language_defn->la_exp_desc->evaluate_exp)
-    (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+  return evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
 }
 
 /* If VAL is wrapped in an aligner or subtype wrapper, return the
diff --git a/gdb/eval.c b/gdb/eval.c
index 8dda837..c185a6f 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -56,9 +56,6 @@ static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
 static struct value *evaluate_subexp_for_address (struct expression *,
 						  int *, enum noside);
 
-static struct value *evaluate_subexp (struct type *, struct expression *,
-				      int *, enum noside);
-
 static char *get_label (struct expression *, int *);
 
 static struct value *evaluate_struct_tuple (struct value *,
@@ -69,7 +66,7 @@ static LONGEST init_array_element (struct value *, struct value *,
 				   struct expression *, int *, enum noside,
 				   LONGEST, LONGEST);
 
-static struct value *
+struct value *
 evaluate_subexp (struct type *expect_type, struct expression *exp,
 		 int *pos, enum noside noside)
 {
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index f1f33ef..777441d 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -1422,8 +1422,8 @@ print_object_command (char *args, int from_tty)
       make_cleanup (free_current_contents, &expr);
     int pc = 0;
 
-    object = expr->language_defn->la_exp_desc->evaluate_exp 
-      (builtin_type (expr->gdbarch)->builtin_data_ptr, expr, &pc, EVAL_NORMAL);
+    object = evaluate_subexp (builtin_type (expr->gdbarch)->builtin_data_ptr,
+			      expr, &pc, EVAL_NORMAL);
     do_cleanups (old_chain);
   }
 
diff --git a/gdb/value.h b/gdb/value.h
index 69a59a2..a70743b 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -499,6 +499,10 @@ extern struct value *evaluate_expression (struct expression *exp);
 
 extern struct value *evaluate_type (struct expression *exp);
 
+extern struct value *evaluate_subexp (struct type *expect_type,
+				      struct expression *exp,
+				      int *pos, enum noside noside);
+
 extern struct value *evaluate_subexpression_type (struct expression *exp,
 						  int subexp);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]