This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: remove OP_OBJC_SELF
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 17 Jun 2011 14:21:57 -0600
- Subject: FYI: remove OP_OBJC_SELF
I'm checking this in on the trunk.
While working on another patch I noticed that OP_OBJC_SELF is not really
needed. It isn't different from OP_THIS in any important way.
This patch removes it.
Built and regtested by the buildbot (which does have the objc compiler
installed...).
Tom
2011-06-17 Tom Tromey <tromey@redhat.com>
* valops.c (value_of_local): Complain if NAME is NULL.
* std-operator.def (OP_OBJC_SELF): Remove.
* parse.c (operator_length_standard) <OP_OBJC_SELF>: Remove.
* objc-exp.y (name_not_typename): Use OP_THIS.
* expprint.c (print_subexp_standard) <OP_THIS>: Print language's
name for "this".
<OP_OBJC_SELF>: Remove.
* eval.c (evaluate_subexp_standard) <OP_OBJC_SELF>: Remove.
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.149
diff -u -r1.149 eval.c
--- eval.c 28 Mar 2011 20:21:03 -0000 1.149
+++ eval.c 17 Jun 2011 20:17:34 -0000
@@ -2830,11 +2830,7 @@
case OP_THIS:
(*pos) += 1;
- return value_of_this (1);
-
- case OP_OBJC_SELF:
- (*pos) += 1;
- return value_of_local ("self", 1);
+ return value_of_local (exp->language_defn->la_name_of_this, 1);
case OP_TYPE:
/* The value is not supposed to be used. This is here to make it
Index: expprint.c
===================================================================
RCS file: /cvs/src/src/gdb/expprint.c,v
retrieving revision 1.51
diff -u -r1.51 expprint.c
--- expprint.c 26 Feb 2011 21:50:41 -0000 1.51
+++ expprint.c 17 Jun 2011 20:17:34 -0000
@@ -499,14 +499,11 @@
case OP_THIS:
++(*pos);
- fputs_filtered ("this", stream);
- return;
-
- /* Objective-C ops */
-
- case OP_OBJC_SELF:
- ++(*pos);
- fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */
+ if (exp->language_defn->la_name_of_this)
+ fputs_filtered (exp->language_defn->la_name_of_this, stream);
+ else
+ fprintf_filtered (stream, _("<language %s has no 'this'>"),
+ exp->language_defn->la_name);
return;
/* Modula-2 ops */
Index: objc-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/objc-exp.y,v
retrieving revision 1.44
diff -u -r1.44 objc-exp.y
--- objc-exp.y 18 Mar 2011 13:51:41 -0000 1.44
+++ objc-exp.y 17 Jun 2011 20:17:34 -0000
@@ -755,8 +755,8 @@
if (innermost_block == 0 ||
contained_in (block_found, innermost_block))
innermost_block = block_found;
- write_exp_elt_opcode (OP_OBJC_SELF);
- write_exp_elt_opcode (OP_OBJC_SELF);
+ write_exp_elt_opcode (OP_THIS);
+ write_exp_elt_opcode (OP_THIS);
write_exp_elt_opcode (STRUCTOP_PTR);
write_exp_string ($1.stoken);
write_exp_elt_opcode (STRUCTOP_PTR);
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.109
diff -u -r1.109 parse.c
--- parse.c 28 Mar 2011 20:21:03 -0000 1.109
+++ parse.c 17 Jun 2011 20:17:34 -0000
@@ -963,7 +963,6 @@
/* C++ */
case OP_THIS:
- case OP_OBJC_SELF:
oplen = 2;
break;
Index: std-operator.def
===================================================================
RCS file: /cvs/src/src/gdb/std-operator.def,v
retrieving revision 1.1
diff -u -r1.1 std-operator.def
--- std-operator.def 1 Feb 2011 18:54:01 -0000 1.1
+++ std-operator.def 17 Jun 2011 20:17:34 -0000
@@ -277,11 +277,6 @@
It just comes in a tight (OP_THIS, OP_THIS) pair. */
OP (OP_THIS)
-/* Objective-C: OP_OBJC_SELF is just a placeholder for the class
- instance variable. It just comes in a tight (OP_OBJC_SELF,
- OP_OBJC_SELF) pair. */
-OP (OP_OBJC_SELF)
-
/* Objective C: "@selector" pseudo-operator. */
OP (OP_OBJC_SELECTOR)
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.276
diff -u -r1.276 valops.c
--- valops.c 6 May 2011 14:12:18 -0000 1.276
+++ valops.c 17 Jun 2011 20:17:36 -0000
@@ -3608,6 +3608,13 @@
struct value * ret;
struct frame_info *frame;
+ if (!name)
+ {
+ if (complain)
+ error (_("no `this' in current language"));
+ return 0;
+ }
+
if (complain)
frame = get_selected_frame (_("no frame selected"));
else